Plotting Pixel count in a image

19 ビュー (過去 30 日間)
Nourhan Mahmoud
Nourhan Mahmoud 2020 年 7 月 27 日
回答済み: KSSV 2020 年 7 月 27 日
What I actually want to achieve is to get pixel count of the image (see attached image) with different channels (Red, Green and overlap)
Is there a way to tell Matlab to count the total of pixels for each channel and plot them?

回答 (1 件)

KSSV
KSSV 2020 年 7 月 27 日
I = imread(myimage);
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);
[R_data, level] = imhist(R);
[G_data, level] = imhist(G);
[B_data, level]=imhist(B);
bar(level, R_data,'r');
hold on;
bar(level, G_data,'g');
bar(level, B_data,'b');

Community Treasure Hunt

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

Start Hunting!

Translated by