ColorChecker function does not work?

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 日
BTW, it was painful to have to post the question twice because the "Captcha" did not work?
Walter Roberson
Walter Roberson 2024 年 1 月 30 日
Please zip the .NEF file and attach the .NEF.zip
Roger Breton
Roger Breton 2024 年 1 月 30 日
Out of curiosity, to test the hypothesis that the ColorChecker function needs a smaller size chart in the image, I took this picture this morning:
As you can see, the chart occupies a small area compared to the size of the image. YET, when running my code, I still the same error message:
Error using colorChecker: Color patches were not detected. Try adjusting the Sensitivity parameter or turning off the Downsample parameter.
Roger Breton
Roger Breton 2024 年 1 月 30 日
With this statement: chart_sRGB = colorChecker(scaled_img, sensitivity=0);
I get: Color patches were not detected. Try adjusting the Sensitivity parameter or turning off the Downsample parameter.
But with sensitivity=1, I this other error message:
Color chart was not detected in the image. Try adjusting input parameters or manually specifying the Registration Points.
Which begs the question, how can I possibly manuall specify the Registration points? I looked at the Registration Point option last night and didn't find anything I could do manually.
oh well, Rome wasn't built in one day...
Roger Breton
Roger Breton 2024 年 1 月 30 日
編集済み: Walter Roberson 2024 年 1 月 30 日
Conduction a search with "ColorChecker" turned a few interesting link, such as this one:
Naturally, I ran the code and it worked:
clc; clear all; close all;
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/812319/image.jpeg';
img = imread(filename);
% use colorChecker
chart = colorChecker(img);
displayChart(chart)
-
I downloaded the chart and could not see how much "different" it was from the my two chart images?
Roger Breton
Roger Breton 2024 年 1 月 30 日
I tried all kinds of things and the only version of the ColorChecker chart that works is the one from MathWorks:
I tried adding white crosses to my charts to no avail?
I tried making the edges of my chart R=G=B=0 to no avail?
I give up.
Roger Breton
Roger Breton 2024 年 1 月 30 日
I tried to trace through execution in the ColorChecker.m but could not find traces of the particular error message I receive :(
Roger Breton
Roger Breton 2024 年 1 月 30 日
I removed the four little "gray" pieces from the chart and it still does not work.
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

タグ

質問済み:

2024 年 1 月 30 日

コメント済み:

2024 年 1 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by