Overview
A tool that calibrates the color of one camera to match another by selecting corresponding color patches in both images and computing a color correction matrix. Built with OpenCV and NumPy.
How it works
- For each image pair, select corresponding color patches (ROIs) in both the reference and target images.
- The tool calculates the average RGB value for each ROI.
- A 3x3 color correction matrix is computed using least-squares regression.
- The matrix transforms colors from the target camera so they match the reference camera.
Usage
pip install -r requirements.txt
python color_correction.py
- Draw ROIs on both images by clicking and dragging; average RGB values print to the console.
- Press
nto process the current pair and move to the next; pressqto quit.
Outputs
color_correction_matrix.npy- the 3x3 correction matrix.roi_data.json- all ROI positions and their average color values.
Tips
Select the same number of ROIs in both images, cover a wide range of colors, and keep each patch relatively uniform for the best fit.