gpt4 book ai didi

matlab - 如何使用 24 block 色卡估计和应用颜色校正矩阵?

转载 作者:太空宇宙 更新时间:2023-11-03 22:46:25 24 4
gpt4 key购买 nike

我有一张 24 色 block 的色卡,我正在尝试为使用该色卡拍摄的图像估算色彩校正矩阵。我已使用 最小二乘法 方法手动估算了 CCM,但未产生理想的结果。某些图像在应用 CCM 后会出现奇怪的阴影。
我仔细检查了我的代码,但没有发现任何故障。我正在寻找任何基于 opencv/matlab 或任何开源实现,我可以在其中提供捕获的颜色值和实际颜色值,并且它可以为我计算和应用 CCM 以确保我的实现是否有问题或至少正方形方法不是很有效。

Note : I'm not applying any linearization to the image before applying CCM. Please suggest any resources where this can be quickly tested.

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);

这是我的结果:

原始图像 enter image description here

修正后的图像

enter image description here

最佳答案

此处详细描述了您使用的颜色校正模型:

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

这也可以在c++ opencv中完成。你必须确定等式:

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

其中 p1',...pn' 是所需值(如果在 XYZ 颜色空间中更好),p1, ...pn 是检测到的实际值,M 是 3x3 变换矩阵。

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

M = P * P'.inv(CV_SVD)

关于matlab - 如何使用 24 block 色卡估计和应用颜色校正矩阵?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46547531/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com