How can ı add cie 1931 chromaticity diagram in my code
3 views (last 30 days)
Show older comments
I found x and y values of picture with my code and I want to show the color in cie 1931 chromaticity diagram with respect to x and y values.
if true
clc;
clear all;
cam=webcam(1);
cam.Resolution = '640x480';
img = snapshot(cam);
figure(1), imshow(img);
regionimg=img(234:246,314:326);
figure(2), imshow(regionimg);
R=img(234:246,314:326,1);
G=img(234:246,314:326,2);
B=img(234:246,314:326,3);
XYZ=rgb2xyz(img);
figure(3), imshow(XYZ);
X=XYZ(234:246,314:326,1);
Y=XYZ(234:246,314:326,2);
Z=XYZ(234:246,314:326,3);
totalX1=sum(X);
totalX=sum(totalX1);
mnX=(totalX/169)
totalY1=sum(Y);
totalY=sum(totalY1);
mnY=(totalY/169)
totalZ1=sum(Z);
totalZ=sum(totalZ1);
mnZ=(totalZ/169)
xCord=mnX/(mnX+mnY+mnZ)
yCord=mnY/(mnX+mnY+mnZ)
plot(xCord,yCord,'+')
clear cam;
end
0 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!