how to create a histogram of R,G,B

조회 수: 14 (최근 30일)
preet
preet 2013년 6월 19일
댓글: Image Analyst 2022년 2월 19일
i have three component R(0-255),G(0-255),B(0-255) i draw 3 different histograms of each component of 8 bins but i need one 2-D histogram of 8 bins.
  댓글 수: 1
Jan
Jan 2013년 6월 19일
What is your question? How do you want to transform the 3 components to a 2D space?

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

답변 (3개)

Youssef  Khmou
Youssef Khmou 2013년 6월 19일
hi,
You mean putting them on one figure, with each component its corresponding color :
I=imread('autumn.tif');
R=imhist(I(:,:,1));
G=imhist(I(:,:,2));
B=imhist(I(:,:,3));
figure, plot(R,'r')
hold on, plot(G,'g')
plot(B,'b'), legend(' Red channel','Green channel','Blue channel');
hold off,

Image Analyst
Image Analyst 2013년 6월 20일
What does this mean? Do you either want (1) histograms of each color channel (either on the same plot or on 3 separate plots), or (2) a scatterplot of the 3D color gamut? I have demos of each of those, just say what you want.
  댓글 수: 4
Sumaiya Ali
Sumaiya Ali 2022년 2월 19일
how can I get the x and y axis numbers for images when I use imshow() like in your output?
Image Analyst
Image Analyst 2022년 2월 19일
@Sumaiya Ali what does "get" mean to you? You can try xticks(), xticklabels(), axis('on', 'image'), or other things. You have not explained very precisely what you want.

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


Chinnu
Chinnu 2020년 5월 13일
편집: Image Analyst 2020년 5월 13일
I=imread('autumn.tif');
R=imhist(I(:,:,1));
G=imhist(I(:,:,2));
B=imhist(I(:,:,3));
figure
plot(R,'r')
hold on,
plot(G,'g')
plot(B,'b')
legend(' Red channel','Green channel','Blue channel');
hold off
  댓글 수: 1
Image Analyst
Image Analyst 2020년 5월 13일
Isn't that the very same as Youssef's answer?

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

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by