Compute color correction matrix in python and C++ | Color correction matrix source code
WecomputeColorCorrectionMatrixA.Inotherwords,wecalculatea4x3matrixAwhichapproximatethefollowingequation.LetPbeareferencecolorcheckermatrix(24x3)andObeacolorcheckermatrixtocorrect(24x3).P=[O1]AWehavetopreparecolorcheckerpatchdataascsvformat.Thereareexampledataindatadirectory.data/colorchart_photo_strobo_linear.csvdata/colorchart_rendered_strobo_linear.csvTheyare24x3matrix.ThedataaremadebyreadingpixelvaluesusingNatron2[1]PythonnumpymatplotlibPillowOpenEXRC++args.hxx(includedinthisrepo)Eigen3Bu...
We compute Color Correction Matrix A. In other words, we calculate a 4x3 matrix A which approximate the following equation.
Let P be a reference color checker matrix (24 x 3) and O be a color checker matrix to correct (24 x 3).P = [O 1] A
We have to prepare color checker patch data as csv format. There are example data in data directory.
data/colorchart_photo_strobo_linear.csv data/colorchart_rendered_strobo_linear.csvThey are 24x3 matrix. The data are made by reading pixel values using Natron2[1]
Python numpy matplotlib Pillow OpenEXR C++ args.hxx(included in this repo) Eigen3 Build c++ version of computeCCM $ cd cpp $ mkdir build $ cmake ../ $ make # computeCCM.py [-h] [-g GAMMA] reference_csv source_csv output_csv $ computeCCM.py data/colorchart_photo_strobo_linear.csv data/colorchart_rendered_strobo_linear.csv ccm.csvThis command generates optimal Color Correction Matri...