필터 지우기
필터 지우기

how to do this

조회 수: 1 (최근 30일)
thelong le
thelong le 2021년 6월 11일
답변: Kishan Dhakan 2021년 6월 16일
I want my input data to be an image that has been converted to XYZ color space to represent on color space instead of having to enter input data, please help me, thanks!
my code ( input data is entered manually )
How do I make the input data an image that has been converted to XYZ space?
% 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),10,rgb,'.');
view(3); grid on;
axis equal
axis([0 1 0 1.1 0 1]);
set(gca,'color','k','gridcolor','k','gridalpha',0.3)
set(gca,'projection','perspective');

답변 (1개)

Kishan Dhakan
Kishan Dhakan 2021년 6월 16일
To convert an image to an XYZ space (or, an m-by-n-by-3 array which RGB color space uses, according to here), you can use the imread function:
X = X = im2double(imread('images.jpg'));
R = X(:,:,1); % Only Red channel
G = X(:,:,2); % Only Green Channel
B = X(:,:,3); % Only Blue Channel
Then, you can easily continue with rgb2xyz(X);

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by