← All projects

Color Correction Tool

Calibrates one camera's color to match another via color patches and a computed correction matrix.

Color Correction Tool

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

  1. For each image pair, select corresponding color patches (ROIs) in both the reference and target images.
  2. The tool calculates the average RGB value for each ROI.
  3. A 3x3 color correction matrix is computed using least-squares regression.
  4. 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 n to process the current pair and move to the next; press q to 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.