我有一个 24 块色卡,我正在尝试使用所述色卡估计捕获图像的颜色校正矩阵。我已经手动估计了CCM
使用least squares
方法,但它没有产生理想的结果。有些图像在应用后会出现奇怪的阴影CCM
.
我仔细检查了我的代码,但没有发现任何问题。我正在寻找任何基于 opencv/matlab 或任何开源实现,在其中我可以提供捕获的颜色值和实际颜色值,并且它可以为我计算和应用 CCM,以确保我的实现是否有问题或至少有问题平方方法不是很有效。
注意:我之前没有对图像应用任何线性化
应用CCM。请建议任何可以快速完成此操作的资源
已测试。
PS:以下是我用来估计和应用颜色校正矩阵 (CCM) 的 MATLAB 代码
% 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 应用于图像的方法
[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);
这是我的结果:
Original Image
![enter image description here](https://i.stack.imgur.com/zI0x4.png)
校正图像
![enter image description here](https://i.stack.imgur.com/syu5h.png)