Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

K230 ISP Image Tuning Guide#

Note: This document focuses on the complete ISP tuning methodology and module parameter descriptions. For the hands-on BLC/LSC/CC calibration workflow, also refer to: how_to_calibrate_isp.md.

Overview#

When tuning image quality, the primary areas of focus are: brightness, color, contrast, and sharpness. Through combined sensor/lens calibration and ISP sub-module tuning, the goals are:

  • Overall image brightness at a reasonable level

  • Accurate color reproduction

  • Good sharpness with no obvious noise

  • High contrast — an overall transparent, vivid look

Overall image tuning flow:

flow

K230 ISP pipeline:

flow

Important notes:

  • In K230 HDR mode, the CSI module does not support sensor data patterns where Hsync precedes Vsync. The Vsync pulses for each frame (L/S/VS) must not overlap during the active data period.

  • When TNR (in 3DNR) is enabled, the ISP requires that sensor Hblank ≥ 180 pixel clocks (256 recommended), and Frame length Active lines 92 lines.


Calibration#

Overview#

The calibration tool (K230ISPCalibrationTool.exe) calibrates parameters for six ISP modules: BLC, LSC, CC, AWB, Noise Profile, and CAC.

Calibration order:

flow

Prerequisites: install MATLAB Runtime (R2023a) before using the calibration tool. Download: https://ssd.mathworks.com/supportfiles/downloads/R2023a/Release/0/deployment_files/installer/complete/win64/MATLAB_Runtime_R2023a_win64.zip

Main interface:

image-20230821114715137

Click the module button to jump directly to that module’s calibration interface.

Black Level Correction#

Principle#

When an analog signal is very weak, the A/D converter may fail to capture it, causing loss of detail in dark areas. To address this, the sensor adds a fixed offset to the analog signal before A/D conversion, preserving more image detail in the output digital signal. Black level correction determines this offset value precisely. All subsequent ISP modules must subtract this offset first to maintain data linearity.

Capture RAW Images#

  1. Cover the lens completely in a fully dark environment — no light must reach the sensor.

  2. Set the sensor to manual exposure mode.

  3. Capture 12 RAW images across different gain (1×, 2×, 3×, 4×) and integration time (0.01 ms, 0.02 ms, 0.03 ms) combinations.

  4. Save to folders named by the combination, e.g. Gain_4_T_0.03 (gain=4, time=0.03 s).

Run Calibration#

Click Black level correction in the main interface:

image-20230821145452924

Steps:

  1. Click Select and choose the RAW image folder.

  2. Align Pos field: enter the Bayer pattern of the RAW images.

  3. Set input/output bit width.

  4. Set resolution (width × height).

  5. Click OK to start calibration.

Options:

  • Combine Channel: if checked, BLC is the combined measurement for all four R/Gr/Gb/B channels.

  • Normal File Out: outputs blc_para.txt.

  • Extended File Out: outputs per-channel BLC at each exposure/gain combination separately.

Example calibration result chart:

image-20230821152200148

Lens Shading Correction (LSC)#

Principle#

LSC eliminates the darkening towards the image corners caused by uneven optical refraction through the lens. The brightness fall-off follows a cosine-to-the-fourth-power law. Calibration captures this attenuation trend and stores the correction in a 32×16 grid to restore each region’s brightness to the center reference level. Both luma shading and color shading are calibrated. Because color shading characteristics differ at different color temperatures, LSC must be calibrated separately for each target color temperature.

Capture RAW Images#

Precautions:

  • Adjust AE target brightness so the image center average is about 80% of the maximum (e.g. 204/255 for 8-bit).

  • Use a flat, uniform light source with a smooth, texture-free target — a DNP light box is ideal.

Steps:

  1. Aim the lens at the DNP light box target area; ensure no environmental interference.

  2. Turn on the light box, select D65, set appropriate illuminance.

  3. Capture one RAW image.

  4. Switch to the next light source (D50, TL84, F12, A) and repeat.

Run Calibration#

Click Lens Shade correction in the main interface:

image-20230821163641202

Steps:

  1. In region 2: select the Bayer pattern, enter width/height/bit-width, choose the correction type (Color Shading or Luma+Color Shading), select the color temperature in the CCT dropdown, and enter the Black Level Offset for each channel.

  2. Click Load image in region 1 to import the RAW image to calibrate.

  3. In region 3: set the grid knots. K230 ISP LSC hardware uses a 32×16 grid → choose “33Full × 17Symm knots”. If using ALSC, check “ALSC uniform…”. Note: if “Automatic initial knot positioning” is checked, ALSC cannot be enabled in auto.json.

  4. In region 4: optionally set the max correction ratio for center/corners.

  5. In region 5: set the corner compensation ratio (e.g. 80% means corners are corrected to 80% of center brightness).

  6. Leave other settings at defaults.

  7. Click Start to calibrate; save the LSC data.

  8. In region 6: apply the LSC data to the image to preview the result; click Save image to file to save a PNG for each light source.

When setting the compensation ratio in step 5, consider how severe the lens shading is. Heavy shading requires large corner gains, which can amplify corner noise. Reduce the compensation ratio to balance noise in the corners.

Color Correction (CC)#

Principle#

CCM calibration measures the actual colors of 24 color checker patches as captured by the sensor and compares them to expected (reference) values to compute a 3×3 CCM matrix. This matrix transforms the sensor’s color space into the standard sRGB color space.

Capture RAW Images#

Steps:

  1. Place the 24-patch color checker inside or in front of the standard light box (lens facing the checker or at 45°).

  2. Turn on the light box, select D65, and adjust illuminance.

  3. Adjust distance and position so the color checker occupies approximately 2/3 of the image.

  4. Adjust AE target so the RAW average brightness is around 50.

  5. Capture one RAW image.

  6. Switch to each other light source (D50, TL84, F12, A) and repeat.

  7. With the lens position unchanged, remove the color checker and capture background RAW images for all five light sources.

Run Calibration#

Click Color Correction in the main interface:

image-20230822111931692

Steps:

  1. In region 1: set width, height, bit-width, Black Level Offset, and Bayer pattern.

  2. Click Load to import:

    • Load sRGB ReferencesCC_Standard.cxf (in Canaan.Calibration.Samples\Data\)

    • Load Color Checker Image — color checker RAW

    • Load Background Image — background RAW

    • To use custom Lab references: Load Lab-Customer References; or load a reference image and use Function → Select Reference Color Check.

  3. Click LSC and load the calibrated LSC parameter file.

  4. Configure calibration parameters: set gamma, check CIELAB reference, configure 24-patch weights, set preferred light source, set output saturation (default 1).

  5. In region 3: select the color patch detection mode (automatic, semi-automatic, or manual). In semi-automatic mode, use the crosshair to click the four corner patches in order.

  6. Click Calibrate to start.

Auto White Balance (AWB)#

Principle#

AWB calibration computes the optimal Planckian locus fit and color temperature fit curve based on the sensor’s white point characteristics (R/G, B/G) under several standard light sources. The goal is to enable the camera to automatically adapt to different color temperature conditions for accurate white and color reproduction.

Run Calibration#

Click Auto White Balance in the main interface:

image-20230822142135073

Steps:

  1. Click file and load the sensor spectral sensitivity file:

    image-20230822152530065

    If you don’t have your sensor’s spectral sensitivity file, use the default OV2775_sensitivity.txt (in Canaan.Calibration.Samples\Data\). AWB calibration no longer strictly depends on this file, so any valid file works.

  2. Click illumination and load CIE_Illuminants.cxf (in Canaan.Calibration.Samples\Data\). Select at least 3 light sources, click OK, and categorize them as indoor or outdoor using the dropdown.

    image-20230822152740591

    image-20230822154937933

  3. Click AWB V2+ Calibration (or Start Calibration in older versions) and select the CC calibration output files for each light source:

    image-20230822155713505

  4. Check White Points Evaluate and select an image for white point estimation.

  5. Click Gain Region Modifier, select the PNG images saved during LSC calibration for each light source, and click OK:

    image-20230822162343131

  6. Define the initial size of the gain polygon; click OK:

    image-20230822162723170

  7. Manually adjust the orange polygon (near-white zone) and black polygon (all pixels inside are classified as white) until the black polygon covers all selected light source white points; save the data:

    image-20230822164058879

K_Factor Calibration#

In the AWB algorithm, the outdoor condition is: Exp × K_Factor 0.12 (where Exp is the exposure value).

For example, if 2000 lux is the outdoor/transition illuminance threshold: obtain the exposure value (ET × gain) at that illuminance, then: K_Factor = 0.12 / (ET × gain).

A larger K_Factor indicates higher sensor sensitivity; a smaller value indicates lower sensitivity. This parameter is in the AWB section of the XML file.

Noise Calibration#

Principle#

Noise profile calibration quantitatively measures and characterizes the noise produced by the sensor under different conditions (light levels, temperature, ISO). Understanding these noise characteristics is key to effective noise reduction.

Capture RAW Images#

  1. Place a black-white gradient test chart inside the standard light box; select D50.

  2. Disable AE and switch to manual exposure. Capture two sets of 30 RAW images each:

    • Bright set: adjust light box brightness so the dark area of the gradient chart is at a medium gray value.

    • Dark set: adjust light box brightness so the white area of the gradient chart is at a medium gray value.

    • Both sets: keep the same exposure time and gain at 1×.

Run Calibration#

Click Noise Calibration in the main interface:

image-20230822170824745

Steps:

  1. Set RAW width, height, bit-width, and Black Level Offset.

  2. Click file to import both the bright and dark RAW image series.

  3. Click ROI to define a region of interest if needed.

  4. Adjust parameters: for the low-light histogram, use the range from Lower Range to Split Point; for the highlight histogram, use Split Point to Higher Range. The two combined should cover nearly all 0–255 values (for 8-bit). The preserved regions of Highlight and Lowlight should follow a Poisson distribution. If BLC offset is set, Lower Range ≥ BLC value.

  5. Leave Gamma Correction and Model Fitting at defaults.

  6. Click Evaluate Measures, then click Fit to Model to complete the calibration and save.

Chromatic Aberration Correction (CAC)#

Principle#

Chromatic aberration is a common optical defect where the lens cannot focus all wavelengths at the same point, causing red/green or blue/purple fringing at image edges. CAC calibration builds a mathematical model from captured image data to describe the aberration, then determines correction parameters.

Capture RAW Images#

  1. Place a checkerboard or dot pattern chart inside the standard light box; select D50.

  2. Adjust AE so the minimum value in black patches is greater than the BLC value, and the maximum value in white areas does not exceed 208.

  3. Capture one RAW image and save it.

Run Calibration#

Click Chromatic Aberration Correction in the main interface:

image-20230822192525126

Steps:

  1. Click Demosaic&Filter and set the Bayer pattern.

  2. Click Load image to load the RAW image.

  3. Configure the Demosaic&Filter settings:

    • ISP_demosaic_threshold: default 4. Higher values detect fewer edges; lower values detect more. 255 disables edge detection.

    • Simulate 2 additional Line Buffers: expands vertical offset range to ±3; no chroma down-filter is applied. Off by default.

    • Filter stage1 select, Sharpen Level, Denoise Level: set as needed.

    • Lum_weight Off: disables the noise weighting function (helps in dark areas). Off by default.

  4. Click Color Correction and configure:

    • Check ISP_bls_enable and set the correct BLC.

    • Check Auto White-Balance.

    • Set CCM.

    • Set global gain to 1.0.

  5. Click Gamma and set the gamma curve (default: gamma 2.2).

  6. Click LSC → Load parameters, load the D50 LSC calibration data, and check Enable.

  7. Click CA Estimate, check CA_Estimate, and click Process to run.

  8. Click CAC to view the calibration results.


Module Reference#

BLS#

Description: Subtracts the black level offset to maintain data linearity.

Parameter

Type / Range

Description

bls_enable

bool

BLS enable switch

bls

int[4], 0–4095

Black level offset for four channels (based on ISP 12-bit)

Tuning note: Although four independent channel values are supported, using the same value for all four is recommended.


LSC#

Description: Corrects lens shading using a 32×16 grid applied to the four RAW channels.

Parameter

Type / Range

Description

enable

bool

LSC enable switch

matrix

float[4][1089]

Lens shading correction matrices for R, Gr, Gb, B; from calibration file

x_size

int[32]

Distance between adjacent X-axis grid knots; from calibration file

y_size

int[16]

Distance between adjacent Y-axis grid knots; from calibration file


Dgain#

Description: ISP digital gain, primarily used to increase image brightness.

Parameter

Type / Range

Description

enable

bool

Digital gain enable switch

digital_gain_r

float, 1.0–255.99

R channel gain

digital_gain_gr

float, 1.0–255.99

Gr channel gain

digital_gain_gb

float, 1.0–255.99

Gb channel gain

digital_gain_b

float, 1.0–255.99

B channel gain


AE#

Description: Auto Exposure controls image brightness. Key tuning areas: AE target brightness, convergence speed, and smoothness.

Parameter

Type / Range

Description

enable

bool

AE enable switch

antiFlickerMode

int, 0–3

Anti-flicker mode: 0=Off, 1=50 Hz, 2=60 Hz, 3=User defined

autoHdrEnable

bool

In HDR mode: true=auto-compute HDR ratio; false=use fixed HDR ratio

dampOver

float, 0–1.0

Damping factor for smooth convergence when overexposed

dampOverGain

float, 0–128.0

Convergence acceleration gain when overexposed and out of clip range

dampOverRatio

float, 1.0–4.0

Clip range ratio for overexposure; smaller = faster convergence

dampUnder

float, 0–1.0

Damping factor for smooth convergence when underexposed

dampUnderGain

float, 0–16.0

Convergence acceleration gain when underexposed and out of clip range

dampUnderRatio

float, 0–1.0

Clip range ratio for underexposure; larger = faster convergence

expV2WindowWeight

float[32×32], 0–255

Per-zone exposure weight

frameCalEnable

bool

Enable frame interval for exposure setting

lowLightHdrGain

float[20], 0–255.0

Gain values per gain step in WDR mode

lowLightHdrLevel

int, 0–16

Total gain steps in WDR mode

lowLightHdrRepress

float[20], 0–1.0

Target brightness suppression ratio per gain step in WDR mode

lowLightLinearGain

float[20], 0–255.0

Gain values per gain step in linear mode

lowLightLinearLevel

int, 0–19

Total gain steps in linear mode

lowLightLinearRepress

float[20], 0–1.0

Target brightness suppression ratio per gain step in linear mode

motionFilter

float, 0–1.0

Smoothing parameter for motion factor in adaptive scene evaluation

motionThreshold

float, 0-1.0

Motion detection threshold

roiNumber

int

Current ROI window index

roiWeight

float

Brightness calculation weight for the current ROI window

roiWindow

float (fx,fy,fw,fh)

Current ROI start coordinates (x,y) and size (w,h)

semMode

int, 0-2

Scene evaluation mode: 0=off, 1=fixed, 2=dynamic

setPoint

float, 0–255.0

AE target brightness

targetFilter

float, 0–1.0

Smoothing factor for AE target changes; larger = faster changes

tolerance

float, 0–100.0

AE target brightness lock range (%)

wdrContrast.max

float, 0–255.0

Max contrast for AE setpoint in adaptive scene evaluation

wdrContrast.min

float, 0–255.0

Min contrast for AE setpoint in adaptive scene evaluation


AWB#

Description: Reduces the influence of ambient light on object color, converting color-shifted objects to appear as they would under ideal daylight.

Parameter

Type / Range

Description

enable

bool

AWB enable switch

awbTempWeight

float, 0.0–1.0

Color temperature light source weight

mode

int, 0 or 1

0=AWB, 1=AWB METADATA

roiNumber

int

Current ROI window index

roiWeight

float

AWB calculation weight for the current ROI window

roiWindow

float (fx,fy,fw,fh)

Current ROI start coordinates (x,y) and size (w,h)

useCcMatrix

bool

Enable adaptive CCM

useCcOffset

bool

Enable adaptive CCM offset

useDamping

bool

Enable AWB damping

kFactor

float

Photo-sensitivity coefficient for outdoor/transition classification

kFactor calibration: outdoor condition: Exp × kFactor 0.12. Example: at 2000 lux as the outdoor threshold, kFactor = 0.12 / (ET × gain). Larger kFactor → higher sensor sensitivity; smaller kFactor → lower sensor sensitivity. This parameter is in the AWB section of the XML file and must be calculated using the method above before filling in.


WDR#

Description: Wide Dynamic Range — improves image contrast using histogram equalization, recovering detail in both highlights and shadows.

Parameter

Type / Range

Description

enable

bool

WDR enable

contrast

int, -1023–1023

Higher = stronger local contrast

entropy

int[20]

Local weight

entropy_base

int

Brightness factor: larger base → stronger local contrast

entropy_slope

int

Brightness factor: larger slope → weaker local contrast

flat_strength

int, 0–19

Flat region stretch strength

flat_thr

int, 0–20

Flat region threshold; below = flat, above = textured

gamma_down

int[20]

Local weight

gamma_pre

int[20]

Local weight

gamma_up

int[20]

Global curve

global_strength

int, 0–128

Global contrast strength

high_strength

int, 0–128

Highlight protection; larger = stronger highlight preservation

low_strength

int, 0–255

Shadow protection; larger = stronger shadow preservation

strength

int, 0–128

Overall strength

Tuning note: In linear mode, set strength=128. low_strength is effectively the max gain — increase it to brighten shadows. high_strength suppresses overexposed highlights. As gain increases, gradually reduce low_strength to avoid noise amplification. Adjust contrast, flat_strength, and flat_thr for local contrast.


GE (Green Equalization)#

Description: Balances Gr and Gb pixel differences in the RAW data to prevent checkerboard or maze-like artifacts from demosaic interpolation. This module is placed before DPCC.

Parameter

Type / Range

Description

enable

bool

Green equalization enable

threshold

float, 0–511.0

Green equalization strength threshold


DPCC (Defective Pixel Cluster Correction)#

Description: Corrects defective pixels before the demosaic module. The static bad-pixel table supports up to 2048 entries. Seven correction setting groups are available.

Parameter

Type / Range

Description

enable

bool

DPCC enable (default off)

bpt_Enable

bool

Bad pixel table enable

bpt_Num

int, 0–1024

Index of current bad pixel in table

bpt_out_mode

int, 0–14

Median output mode for bad pixel correction

bpt_pos_X

int

Horizontal address of bad pixel

bpt_pos_Y

int

Vertical address of bad pixel

bypass

bool

Bypass DPCC

line_mad_fac

int[2][3], 0–63

Mean absolute difference factor

line_thresh

int[2][3], 0–255

Row threshold for R/G/B

methods_set

int[3], 0–8191

Bad pixel correction method selection per channel

out_mode

int, 0–15

Interpolation mode for correction unit

pg_fac

int[2][3], 0–63

Peak gradient factor

rg_fac

int[2][3], 0–63

Rank gradient factor

rnd_offs

int[2][3], 0–3

Rank neighbor difference rank offset

rnd_thresh

int[2][3], 0–63

Rank neighbor difference threshold

ro_limits

int[2][3], 0–3

Rank offset limit

set_use

int, 1–7

Select which correction setting group to use


DPF (Bilateral Filter)#

Description: Bilateral filter for noise reduction.

Parameter

Type / Range

Description

enable

bool

Enable switch

gain

float, 1.0–1000.0

Sensor gain

gradient

float, 0.1–128

Gradient

min

float, 1.0–128.0

Strength clip

offset

float, 0–128.0

Higher = stronger noise reduction

div

float, 0–64.0

Higher = weaker noise reduction

sigma_g

float, 1.0–128.0

Spatial filter for G channel; higher = more weight

sigma_rb

float, 1.0–128.0

Spatial filter for R/B channels; higher = more weight

noise_curve

float, 0–4095.0

17-point curve; from calibration file


DNR (3D Noise Reduction)#

Description: 3DNR combines temporal and spatial domain information for more effective noise reduction. Motion detection ensures moving objects retain sharpness.

Parameter

Type / Range

Description

enable

bool

Master enable for 2DNR and 3DNR

tnr_en

bool

3DNR enable

nlm_en

bool

2DNR enable

sigma

float, 0.1–16.0

2DNR strength; higher = stronger

strength

float, 0–128.0

2DNR strength; higher = stronger

blend_motion

float, 0–100.0

Blend weight between 2DNR-processed and TNR-output frames; affects denoise strength without changing motion estimation

blend_slope

float, 0.1–32.0

Blend slope; higher = more weight to NLM. Smaller = higher static blend weight; larger = higher motion blend weight

blend_static

float, 0–100.0

Blend weight for static regions between 2DNR and TNR output

dialte_h

float

Motion dilation window width

filter_len

float, 0–1024

Temporal filter window length (number of reference frames)

filter_len2

float, 0–100

Motion history frame count

motion_dilate_en

bool

Motion dilation enable

motion_erode_en

bool

Motion erosion enable

noise_level

float, 0–1024

Motion detection threshold; above = motion region

noisemodel_a

float

Slope of custom pre-gamma curve

noisemodel_b

float

Offset of custom pre-gamma curve

pregamma_en

bool

Pre-gamma transform enable

preweight

float

Weight of previous frame’s motion information

range_h

float

Horizontal motion detection window radius (7 = 15×15)

range_v

float

Vertical motion detection window radius (7 = 15×15)

sadweight

float

Weight for motion difference type A

thr_motion_slope

float

Transition slope; above this = 100% motion region

Tuning steps: 1. Enable tnr, nlm, dilate, erode, pregamma. 2. Set filter_len for reference frame damping. 3. Set filter_len2 for motion frame damping. 4. Use noise_level to separate foreground and background. 5. Adjust thr_motion_slope, sad_weight, and preweight to define the motion region.

When TNR is enabled: sensor/ISP Hblank ≥ 180 pixel clocks (256 recommended); Vblank minimum ≥ 60 sensor ET lines.


Demosaic#

Description: Converts Bayer RAW data to RGB via interpolation. Also supports denoising, sharpening, demoire, and depurple.

Parameter

Type / Range

Description

demosaic_enable

bool

Demosaic enable

demosaic_thr

int, 0–255

Interpolation threshold for R/B channels; below = non-directional interpolation

dmsc_dir_thr_min

int, 0–4095

G channel interpolation threshold in dark areas

dmsc_dir_thr_max

int, 0–4095

G channel interpolation threshold in bright areas

dmsc_denoise_strength

int, 0–31

Low-frequency denoising strength

dmsc_sharpen_enable

bool

Sharpen enable

dmsc_sharpen_clip_black

int, 0–2047

Dark edge sharpening clip limit

dmsc_sharpen_clip_white

int, 0–2047

Bright edge sharpening clip limit

dmsc_sharpen_factor_black

int, 0–511

Dark edge sharpening factor; higher = stronger

dmsc_sharpen_factor_white

int, 0–511

Bright edge sharpening factor; higher = stronger

dmsc_sharpen_line_enable

bool

Line sharpening enable

dmsc_sharpen_line_r1

int, 0–255

Sharpening strength for values below threshold

dmsc_sharpen_line_r2

int, 0–255

Sharpening strength for values above (thr + (1<<thr_shift1))

dmsc_sharpen_line_strength

int, 0–4095

Line sharpening strength; higher = stronger

dmsc_sharpen_line_thr

int

Line sharpening threshold

dmsc_sharpen_line_thr_shift1

int, 0–10

Line sharpening threshold shift parameter

dmsc_sharpen_r1

int, 0–256

Sharpening curve parameter

dmsc_sharpen_r2

int, 0–256

Sharpening curve parameter

dmsc_sharpen_r3

int, 0–256

Sharpening curve parameter

dmsc_sharpen_size

int, 0–16

High-frequency signal representation; smaller = more fine detail sharpened

dmsc_sharpen_t1

int, 0–2047

Sharpening curve value point t1

dmsc_sharpen_t2_shift

int, 0–11

Sharpening curve value point (t1 + (1<<t2_shift))

dmsc_sharpen_t3

int, 0–2047

Sharpening curve value point t3

dmsc_sharpen_t4_shift

int, 0–11

Sharpening curve value point (t3 + (1<<t4_shift))

dmsc_demoire_enable

bool

Demoire enable

dmsc_demoire_area_thr

int, 0–32

Moire area threshold; only regions above this are processed

dmsc_demoire_r1

int, 0–255

Moire removal strength for values below t1

dmsc_demoire_r2

int, 0–255

Moire removal strength for values above (t1 + (1<<t2_shift))

dmsc_demoire_t1

int, 0–255

Moire removal strength curve value point t1

dmsc_demoire_t2_shift

int, 0–8

Moire removal strength curve value point (t1 + (1<<t2_shift))

demoire_edge_r1

int, 0–255

Moire transition curve rate for values below t1

demoire_edge_r2

int, 0–255

Moire transition curve rate for values above (t1 + (1<<t2_shift))

demoire_edge_t1

int, 0–511

Moire transition curve value point t1

demoire_edge_t2_shift

int, 0–9

Moire transition curve value point (t1 + (1<<t2_shift))

dmsc_demoire_sat_shrink

int, 0–32

Saturation reduction in moire regions; larger = stronger

dmsc_depurple_enable

bool

Purple fringe (depurple) enable

dmsc_depurple_cbcr_mode

int, 0–3

0=off, 1=R channel, 2=B channel, 3=R+B

dmsc_depurple_sat_shrink

int, 0–8

Saturation reduction in purple fringe areas

dmsc_depurple_thr

int, 8–255

Purple fringe detection threshold; smaller = more pixels treated as purple

Tuning notes:

  • Interpolation: for 12-bit RAW, dir_thr_min applies at pixel value 0 and dir_thr_max at 4095; intermediate values are interpolated. demosaic_thr: gradient diff > threshold → directional interpolation; < threshold → average interpolation. Smaller values cause more false color in high-frequency regions.

  • Sharpening/Denoising: denoise_strength=0 disables denoising in demosaic (usually preferred; enable only for very noisy images). A steeper sharpening curve = stronger sharpening. sharpen_line smooths horizontal/vertical lines when noise is high. The basic effect of sharpen_line is to smooth lines or textures in the horizontal or vertical direction. Larger sharpen_line_r1 and sharpen_line_r2 values make the sharpening result closer to directional (horizontal or vertical) enhancement; however, more points may be incorrectly connected, which can introduce errors in high-frequency details. factor > clip should be avoided — it over-sharpens without enough tone gradation.

  • Demoire: moire correction uses a transition curve and a removal strength curve; see referenced diagrams.

image-20230828143338539

image-20230828145740677

image-20230904094148683

image-20230904094333522


ManualWB#

Description: Manually set white balance gain values.

Parameter

Type / Range

Description

driver_load

bool

Whether to load parameters from this module

gain

float[4], 1.0–3.999

White balance gain for all four channels


CCM (Color Correction Matrix)#

Description: Linear color space correction using a standard 3×3 matrix and vector offset. Transforms sensor color space to sRGB.

Parameter

Type / Range

Description

enable

bool

CCM enable

ccmatrix

float[9], -8.0–7.996

3×3 color correction matrix

ccoffset

int[3], -2048–2047

Per-channel offset


Gamma#

Description: Non-linear brightness transformation to match the characteristics of typical output devices.

Parameter

Type / Range

Description

enable

bool

Gamma enable

standard

bool

Standard gamma enable

standard_val

float

Gamma value (default 2.2)

curve

int[64]

64-point gamma curve

Tuning note: Default is gamma 2.2. Custom gamma curves can be defined as needed.


EE (Edge Enhancement)#

Description: Sharpens image detail and texture. Also suppresses black/white fringing at edges.

Parameter

Type / Range

Description

enable

bool

EE enable

ee_strength

int, 0–128

EE overall strength

ee_src_strength

int, 0–255

Denoising strength; larger = stronger. Default 1

ee_y_up_gain

int, 0–10000

Bright edge gain

ee_y_down_gain

int, 0–10000

Dark edge gain

ee_uv_gain

int, 0–1024

Edge color saturation control; larger = more saturation reduction

ee_edge_gain

int, 0–10000

Edge detail detection strength; larger = more edges detected


CA (Color Adjustment)#

Description: Adjusts image saturation using a UV gain curve. Primarily eliminates color noise in dark or low-saturation regions. Also reduces false colors in overexposed highlights and white balance deviation in low-saturation areas.

Parameter

Type / Range

Description

ca_en

bool

CA enable

curve_en

bool

ca_curve and dci_curve enable

ca_mode

int, 0–2

0=adjust saturation by luma; 1=adjust by original saturation; 2=both

ca_curve

float

64-point CA curve


DCI (Dynamic Contrast Improve)#

Description: Adjusts global image contrast.

Parameter

Type / Range

Description

dci_en

bool

DCI enable

dci_curve

float

64-point DCI curve


CProcess (Color Processing)#

Description: Color processing in the YUV domain.

Parameter

Type / Range

Description

enable

bool

CProcess enable

luma_in

int

Luminance input range: 0=[64..940], 1=full [0..1023]

luma_out

int

Luminance output clipping: 0=[16..235], 1=[0..255]

chroma_out

int

Chrominance output clipping: 0=[16..240], 1=full [0..255]

bright

float, -128–127

Brightness adjustment

contrast

float, 0.3–1.9921875

Contrast adjustment

hue

float, -90–89

Hue adjustment

saturation

float, 0–1.9921875

Saturation adjustment


Compand#

Description: Data compression and expansion module.

Parameter

Type / Range

Description

enable

bool

Compression/expansion enable

compress_enable

bool

Compression enable

compress_curve_x

int[64], 0–31

Compression X-axis interval curve

compress_use_out_y_curve

bool

Use output Y-axis curve for compression

compress_curve_y

int[64], 0–16777216

Compression Y-axis value curve

expand_enable

bool

Expansion enable

expand_curve_x

int[64], 0–31

Expansion X-axis interval curve

expand_use_out_y_curve

bool

Use output Y-axis curve for expansion

expand_curve_y

int[64], 0–16777216

Expansion Y-axis value curve


CAC (Chromatic Aberration Correction)#

Description: Corrects lateral chromatic aberration.

Parameter

Type / Range

Description

a_blue

float, -16–15.9375

Radial blue shift parameter (formula: a_blue·r + b_blue·r² + c_blue·r³)

a_red

float, -16–15.9375

Radial red shift parameter (formula: a_red·r + b_red·r² + c_red·r³)

b_blue

float, -16–15.9375

Radial blue shift parameter

b_red

float, -16–15.9375

Radial red shift parameter

c_blue

float, -16–15.9375

Radial blue shift parameter

c_red

float, -16–15.9375

Radial red shift parameter

cac_enable

bool

CAC enable

center_h_offs

int

Horizontal distance between image center and optical center

center_v_offs

int

Vertical distance between image center and optical center

a/b/c_blue → XML blue_parameters; a/b/c_red → XML red_parameters; center_h_offs → XML x_offset; center_v_offs → XML y_offset.

Comments list
Comments
Log in