Pipeline to denoise camera images/videos with swappable stages. All code lives in Code/, inputs in Image/ and Video/, outputs in Result/.
- Activate env:
C:\Users\IvaneChen\anaconda3\envs\image_processing_hw1\python.exe. - Run default (Fast NLM color):
python Code/main.py. - Choose method:
python Code/main.py --denoise-method fast_nlm_grayor--denoise-method bilateral. - Optional flags:
--resize-max-side 960(speed),--image-limit 5,--video-limit 1,--videos campus.mp4 WIN_20251128_03_47_51_Pro.mp4,--param h=12 hColor=10. - Skip groups:
--skip-imagesor--skip-videos. - Use custom JSON config:
python Code/main.py --config Code/sample_config.json. - Add sharpening:
python Code/main.py --add-sharpen --sharpen-method laplacian_edge --sharpen-param alpha=0.4. - Add color/contrast:
python Code/main.py --add-color --color-method clahe --color-mode day(or--color-mode night/--color-auto). - Add tone mapping:
python Code/main.py --add-tonemap --tone-method reinhard --tone-mode day(night or--tone-autoalso supported). - Add frame interpolation (video only):
python Code/main.py --add-frame-interp --frame-interp-method dis_optical_flow(defaults to a fast compensated blend).
denoise(methods:fast_nlm_color,fast_nlm_gray,bilateral). Defaults live inCode/stages/denoise.pyand can be overridden with--param key=value.sharpen(methods:unsharp,laplacian_edge). Append with--add-sharpen --sharpen-method unsharpand tweak with--sharpen-param key=value(defaults inCode/stages/sharpen.py).color(methods:clahe,white_balance,gamma) with day/night presets and optional auto-switching. Defaults inCode/stages/color.py; override with--color-param key=value.tone(methods:reinhard,aces,sigmoid,dragoif available) with day/night or auto mode. Defaults inCode/stages/tonemap.py; override with--tone-param key=value.frame_interpolation(video-only; methods:compensated_blend,dis_optical_flow) inserts midpoint frames and doubles output FPS. Configure with--frame-interp-methodand--frame-interp-param key=value.undistort(lens calibration) loadscamera_calib.npzand should run first to correct distortion; configure via stage params (alpha,calib_path,use_new_camera_matrix).- Architecture is stage-based (
StageinCode/stages/base.py) so new transforms can be added viabuild_stageinCode/pipeline.py.
{
"resize_max_side": 960,
"stages": [
{"kind": "denoise", "params": {"method": "fast_nlm_color", "h": 10, "hColor": 10}}
]
}- Images:
Result/images/<name>_<pipeline_tag>.jpg - Videos:
Result/videos/<name>_<pipeline_tag>.mp4(keeps FPS, mp4v codec)
- Logs show stages, params, file paths, and runtime per file. Add
--verbosefor debug logs.