本文介绍了如何使用24块色卡估算和应用色彩校正矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个24块色卡,我正在尝试为使用所述色卡捕获的图像估计色彩校正矩阵.我已经使用least squares方法手动估算了CCM,但未产生令人满意的结果.应用CCM后,某些图像会出现怪异的阴影.
我已经仔细检查了我的代码,但找不到任何故障.我正在寻找任何基于opencv/matlab或任何开源实现的地方,在这些地方我可以提供捕获的颜色值和实际颜色值,并且可以为我计算和应用CCM以确保是我的实现出现问题还是最少平方法不是很有效.

I have a 24 block color card and I'm trying to estimate a color correction matrix to the captured images with the said color card. I have manually estimated a CCM using the least squares method and it's not producing desirable results. Some images get a weird shade after applying CCM.
I have double checked my code but couldn't find any glitches. I'm looking for any opencv/matlab based or any open source implementations where I can provide the captured color values and the actual color values and it can calculate and apply CCM for me to make sure if it's my implementation which has problems or the least squares method is not very effective.

PS:以下是我用来估计和应用色彩校正矩阵(CCM)的MATLAB代码

PS : Following is the MATLAB code I'm using to estimate and apply the Color Correction Matrix (CCM)

% calc 3x3 correction matrix
ccm = MactAll * MrawAll' * inv(MrawAll * MrawAll') % MactAll is the 3x24 matirx of actual color card values and MrawAll is the 3x24 matrix of captured color card values

这是我将CCM应用于图像的方式

here's how I'm applying the CCM to the image

[my, mx, mc] = size(imageRGB);  % rows, columns, colors (3) % 
imageRGB = reshape(imageRGB,my*mx,mc); 
correctedRGB = imageRGB*ccm;  
correctedRGB = min(correctedRGB,1);  correctedRGB = max(correctedRGB,0);  % Place limits on output.

correctedRGB = reshape(correctedRGB, my, mx, mc); 
correctedRGB = uint8(correctedRGB*255);

这是我的结果:

原始图片

校正后的图像

推荐答案

您正在使用的色彩校正模型在此处得到了很好的描述:

color correction model you are using is well described here:

https://www .informatik.hu-berlin.de/de/forschung/gebiete/viscom/thesis/final/Studienarbeit_Behringer_201308.pdf

这也可以在c ++ opencv中完成.您必须确定方程式:

This can also be done in c++ opencv. You have to determine equation:

 [p1' p2' ... pn' ] = M * [ p1 p2 ... pn]
         P'         = M *        P

其中p1',... pn'是期望值(如果在XYZ颜色空间中更好),p1,... pn是检测到的真实值,M是3x3转换矩阵.

Where p1',...pn' are desired values (better if in XYZ color space), p1, ... pn are real values detected and M is 3x3 transformation matrix.

您可以按以下方式解决该系统:

You could solve that system as follows:

M = P * P'.inv(CV_SVD)

这篇关于如何使用24块色卡估算和应用色彩校正矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 04:11