Color space conversion xyz2srgb, using makecform function
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jo
am 4 Jun. 2015
Bearbeitet: Walter Roberson
am 9 Jun. 2015
Hi
I have an image and try to convert it from XYZ to sRGB in order to display the image on the screen and be able to draw a ROI. I used the makecform function but it seems that it doesn't work well as I get a black image instead!
RGB=zeros(size(XYZ2));
cform=makecform('xyz2srgb');
RGB=applycform(XYZ2,cform);
Here are the max values of the XYZ and RGB matrices I get, respectively
max(max(XYZ2))
ans(:,:,1) = 31.6600, ans(:,:,2) =33.5200, ans(:,:,3) = 40.6900
max(max(RGB))
ans(:,:,1) = 1, ans(:,:,2) = 1, ans(:,:,3) = 1
Do you may have an idea? Did I use the cform function wrongly?
Many thanks in advance
0 Kommentare
Akzeptierte Antwort
Radha Krishna Maddukuri
am 9 Jun. 2015
This issue is happening because of scaling of the input data. The function 'xyz2srgb' expects input values in the range of 0 to 1.
Therefore, the input data can be scaled by dividing it with a standard value or the maximum value for the data.
clear
XYZ2 = [10 20 30; 40 50 60; 70 80 90; 100 110 120; 130 140 150; 160 170 180];
RGB=zeros(size(XYZ2));
cform=makecform('xyz2srgb');
RGB=applycform(XYZ2/180,cform);
I hope this helps you with the issue that you are facing.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Color finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!