Automatically remove color mask from camera raw film scans.
Process order.
stages = [
RawLoadStage("LoadRAW"),
BorderExtractStage("BorderExtract"),
ColorClassifyStage("ColorClassify"),
WhiteBalanceComputeStage("WBCompute"),
WhiteBalanceApplyStage("WBApply"),
InvertStage("Invert"),
LevelRegionSelectStage("LevelRegionSelect"),
LevelAdjustStage("LevelAdjust"),
ToneAdjustStage("ToneAdjust"),
]- black/white point auto tune by threshold first
- overwrite with specific black/white if --tone-white, --tone-black, --level-white-point is not None
- run:
python cast_off.py ./RAW.dng --border u0.02 --level-pixel-threshold 0.0001 --wb-ix 4,3 --debug --visualize --tone-pixel-threshold 0.02 --center-ratio 0.8 --tone-black 37000- get vis like:
- output:
python cast_off.py ./ZFC_5837.NEF --border l0.1,r0.1 --level-pixel-threshold r0.001,g0.001,b0.03 --wb-ix 4,1 --debug --visualize --tone-pixel-threshold 0.03 --tone-white 64000 --level-white-point "b61000" --save-preset ./preset.pklpython cast_off.py ./ZFC_5837.NEF --load-preset ./preset.pkl -o "new_{name}.png"- White Balance: Compute white balance from border area, apply to entire image
- Classify border pixels into clusters by brightness
- Select specific clusters for white balance calculation
--wb-ix 4,0,1means 4 clusters, select[0, 1]to compute wb.
- Invert: Invert all 3 RGB channels (negative to positive)
- Level Adjustment: Redefine black and white points
- Automatically calculate percentile threshold for each channel
- Luminance Adjustment
- Set black/white point from [0, 65535]

