ColorChecker function does not work?

12 次查看(过去 30 天)
I am trying to follow the example here:
I use this code:
cfa = rawread("DSC_0136.NEF");
J = demosaic(cfa,"rggb");
A_sRGB = lin2rgb(J);
montage({J,A_sRGB})
title("Original Image Before and After Gamma Correction")
chart_sRGB = colorChecker(A_sRGB);
% chart_sRGB = colorChecker(rgb, sensitivity=0);
DisplayChart(chart_sRGB)
But I keep running into this error:
Error using colorChecker
Color patches were not detected. Try adjusting the Sensitivity parameter or turning off the Downsample parameter.
This is my test NEF:
Why is the functioon failing?
I tried varying the sensitivity from 0 to 1 and turning downsampling off to no avail.
Is the function not designed to operate on a picture of the chart that's full-frame?
  10 个评论
Roger Breton
Roger Breton 2024-1-30
From the ColorChecker documentation, I discovered that it was possible to manually detect the chart by supplying the corner points? So I used the MathWorks ColorChecker chart that "works", giving this output:
chart =
colorChecker with properties:
Image: [876×1312×3 uint8]
RegistrationPoints: [4×2 double]
ColorROIs: [24×1 struct]
... to try to "reverse-engineer" the chart object?
I imported the image into Adobe Illustrator and looked up the "RegistrationPoints" array onto the image. Using these coordinates, I tried to create the chart object using this code:
cornerPoints = [1113,632;638,636;632,323;1110,320];
chart = colorChecker(rgbImage,"RegistrationPoints",cornerPoints);
This method may not be elegant but if it allows me to experiment with the more advanced functions I want to get at like "measure WhiteBalance", it's worth the effort! So here is my result:
I should not have to work this hard...
Roger Breton
Roger Breton 2024-1-30
The RegistrationPoints order is:
[Lower Right X, Lower Right Y; Lower Left X, Lower Left Y; Upper Left X, Upper Left Y; Upper Right X, Upper Right Y]

请先登录,再进行评论。

回答(0 个)

标签

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by