How can i plot a color bar for an RGB image ?

조회 수: 7 (최근 30일)
sam  CP
sam CP 2018년 6월 24일
답변: Walter Roberson 2018년 6월 25일
RGB = imread('saturn.png');
I = rgb2gray(RGB);
h = [1 2 1; 0 0 0; -1 -2 -1];
I2 = filter2(h,I);
imshow(I2,'DisplayRange',[]), colorbar
I have found the above codes for grayscale image.

답변 (2개)

KSSV
KSSV 2018년 6월 25일
  댓글 수: 3
Walter Roberson
Walter Roberson 2018년 6월 25일
colorcloud was new as of R2016b.
You did not enter your MATLAB Release information when you created the question, so we are going to assume you have the newest release.
sam  CP
sam CP 2018년 6월 25일
I'm using 2016a

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


Walter Roberson
Walter Roberson 2018년 6월 25일
RGB images do not have colorbars. colorbar relates a linear (or log) value to the color the value is mapped to, but RGB images express color directly; there is no linear (or log) value being mapped to a color.
We could create a bar chart relating each RGB color to the number of times that color occurs, but your image has over 150000 RGB colors so you would need like 100 displays end to end even if the bars were only one pixel wide.

카테고리

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