Color Correction Matrix (linear vs RGB)
Mostra commenti meno recenti
I've been playing with the new color correction functions in the Image Processing Toolbox, and I have a small conundrum. My solution is better when I apply gamma correction (lin2rgb() ) before calculating / applying the color correction matrix (derived from measureColor() ). The mean Delta_E ends up around half. I'm no color guru, but thought it was standard to keep the image linear when calculating / applying the matrix (the folks at Imatest are pretty emphatic about it https://www.imatest.com/docs/colormatrix/#linear ). Anyone have some insight why this is happening? Here's my code and the solution with then without gamma correction before the color correction. (Note: linearity of the demosaiced image, dJ has been verified by plotting gray chip signals against their mean spectral reflectances & calChartMeasure is basically the measureColor() function with some fiducial marking stuff added)
clear all;
close all;
calibrationIm = 's1500.raw';
% import the raw calibration image
J = rawImport(calibrationIm);
% demosaic the raw Bayer data
dJ = uint8(demosaicing_v2(double(J),'gradient'));
figure;
histogram(dJ)
saveas(gcf,'Histogram_Demosaicked.png')
figure;
imshow(dJ)
saveas(gcf,'Image_Demosicked.png')
% measure delta E
[dchart, dcolorTable, dccm] = calChartMeasure(dJ);
figure;
displayChart(dchart);
saveas(gcf,'Raw Chart Location.png')
figure;
displayColorPatch(dcolorTable);
saveas(gcf,'Raw Delta E values.png')
figure;
plotChromaticity(dcolorTable)
saveas(gcf,'Chromaticity Before Correction.png')
% apply gamma correction
gJ = lin2rgb(dJ);
figure;
imshow(gJ)
saveas(gcf,'Image_GammaCorrected.png')
[gchart, gcolorTable, gccm] = calChartMeasure(gJ);
figure;
displayChart(gchart);
saveas(gcf,'Gamma Chart Location.png')
figure;
displayColorPatch(gcolorTable);
saveas(gcf,'Gamma Delta E values.png')
figure;
plotChromaticity(gcolorTable)
saveas(gcf,'Chromaticity After Gamma.png')
% apply color correction matrix
ccJ = imapplymatrix(gccm(1:3,:)',gJ,gccm(4,:));
%ccJ = imapplymatrix(gccm(1:3,:)',gJ);
figure;
imshow(ccJ)
saveas(gcf,'Image_ColorCorrected.png')
[ccchart, cccolorTable, ccccm] = calChartMeasure(ccJ);
figure;
displayChart(ccchart);
saveas(gcf,'CCM Chart Location.png')
figure;
displayColorPatch(cccolorTable);
saveas(gcf,'CCM Delta E values.png')
figure;
plotChromaticity(cccolorTable)
saveas(gcf,'Chromaticity After CCM.png')
delE = mean(cccolorTable.Delta_E);
close all;




3 Commenti
Ben Hendrickson
il 27 Ago 2021
Image Analyst
il 27 Ago 2021
Where did you get the function calChartMeasure()?
Ben Hendrickson
il 30 Ago 2021
Risposta accettata
Più risposte (2)
Ben Hendrickson
il 3 Set 2021
0 voti
Jeroen Van der poel
il 2 Giu 2022
0 voti
Hey @image specialist. I have a question if you also calculate color matrixes professionally. We have xrite colorchart and used imatest but even though imatest gives us good results once we try to put the new matrix in dng file the results are off to a point that we simply want to hire someone. Is this something you do?
Categorie
Scopri di più su Blue in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


