how to display two colours in one graph?

조회 수: 3 (최근 30일)
Seba.V
Seba.V 2020년 4월 26일
답변: Image Analyst 2020년 4월 26일
Hello everyone,
I first use cat() to define the color from RGB values and then I am trying to plot the colors of two differnet pixel one next to the other using image().
Any suggestions on how I can do that?
this is working for me but i would like to have them showing in the same graph and figure
Thank you in advance
figure
image(truecolor_image)
figure
image(truecolor_image1)
axis equal
  댓글 수: 2
Image Analyst
Image Analyst 2020년 4월 26일
I have no idea what you want to do. cat() does not define colors. And image() does not plot color values - it displays images. So I have no idea what you want as a "graph". Please mock up a picture and post it so we can figure out what you want.
Seba.V
Seba.V 2020년 4월 26일
Sorry I hope the picture makes a bit more sense.
I have the color of two pixels and i want to show them one next to the other instead of in two separate images.

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

채택된 답변

Image Analyst
Image Analyst 2020년 4월 26일
See Steve's blog:
Or else just do this:
imageHeight = 300;
% Create an image of all 1's.
blank = ones(imageHeight, 'uint8');
% Assign (or get) the two RGB values into a vector.
rgb1 = [0, 255, 255];
rgb2 = [255, 146, 0];
% Create two images. One image for each color.
color1 = cat(3, rgb1(1) * blank, rgb1(2) * blank, rgb1(3) * blank);
color2 = cat(3, rgb2(1) * blank, rgb2(2) * blank, rgb2(3) * blank);
% Stitch them together into one image.
twoPixels = [color1, color2];
% Display that image.
imshow(twoPixels);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by