program that reads the color value in the CIE xyz color space and represents it on 3d space coordinates

조회 수: 15 (최근 30일)
i am new to matlab programming my first exercise is to read value in CIE xyz color space and represent it in 3d color space i tried but still not working can someone guide me how to do are not? Thanks very much
lab(:,1)=str2double(get(handles.hesoa,'String'));
lab(:,2)=str2double(get(handles.hesob,'String'));
lab(:,3)=str2double(get(handles.hesol,'String'));
axes(handles.axes1); xlabel('a');
ylabel ('b*');
zlabel ('L*');
axis([-100 100 -100 100 0 100]);
hold on;
x=-100:100;
y=x*0;
z=x*0;
plot3(x,y,z+50,'b','LineWidth',1);
plot3(y,x,z+50,'b','LineWidth',1);
plot3(y,z,x,'b','LineWidth',1);
plot3(lab(:,2),lab(:,3),lab(:,1),'.','Markersize',20);
title('khong gian mau CIExyz');
  댓글 수: 1
DGM
DGM 2021년 6월 6일
You say you want to use a color point in CIEXYZ, but you're using CIELAB. These aren't the same thing. You'll need to specify which you actually want and what the input is. If you're starting with an RGB tuple and you want XYZ, there's no need to use LAB.

댓글을 달려면 로그인하십시오.

답변 (2개)

DGM
DGM 2021년 6월 6일
Maybe this is of use.
% generate two clusters of color points
lab1 = randn(100,3).*[40 10 20] + [40 -40 40];
lab2 = randn(100,3).*[40 10 20] + [40 40 -40];
lab = [lab1; lab2];
xlabel('a');
ylabel ('b*');
zlabel ('L*');
hold on;
% plot the points
plot3(lab(:,2),lab(:,3),lab(:,1),'.','Markersize',20);
view(3); grid on;
axis equal
axis([-100 100 -100 100 0 100]);
My comment about whether you want XYZ or LAB still holds. If you want XYZ, just use rgb2xyz() and xyz2rgb().
  댓글 수: 2
thelong le
thelong le 2021년 6월 7일
thank you, I have determined my direction, my exercise now is to read the RGB color value and convert to XYZ , then represent that value in 3d space, after displaying pixels is there a way to colorize that pixel, thanks for your opinion
DGM
DGM 2021년 6월 7일
This is pretty easy with scatter.
% generate two clusters of color points
rgb = min(abs(randn(2000,3).*[0.5 0.3 0.1] + [0 0 0]),1);
rgb = [rgb; 1-rgb];
xyz = rgb2xyz(rgb);
xlabel('X');
ylabel('Z');
zlabel('Y');
hold on;
% plot the points
scatter3(xyz(:,1),xyz(:,3),xyz(:,2),100,rgb,'.');
view(3); grid on;
axis equal
axis([0 1 0 1.1 0 1]);
set(gca,'color','k','gridcolor','w','gridalpha',0.3)
set(gca,'projection','perspective');
I inverted the background so it's easier to see the color of the points. We can check to see if this distribution of points makes sense. MIMT (on the file exchange) has a crude viewing tool called csview().
csview('xyz','alpha',0.2,'invert',1); hold on; % do this before scatter3()
Since all the color points started within the confines of sRGB, their projection into XYZ lies within the projection of the parent space. We only have a few points, but that does appear to hold true.
You don't need to actually use csview(), but I figured I might as well disclose how I made the illustration.

댓글을 달려면 로그인하십시오.


thelong le
thelong le 2021년 6월 8일
last question, i feel embarrassed to ask you a bit too much but if you can help me, that would be great, thank you very much(^^)
I want to read the color value of the input image and then represent the color value of that image in the 3d XYZ color space as shown below via the command.
plotChromaticity("ColorSpace","uv","View",3,"BrightnessThreshold",0).
The final result is a color space with the color points shown below.
You can refer to this link.(https://ch.mathworks.com/help/images/ref/plotchromaticity.html#d123e231937)
thanks bro again

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by