Displaying how many pixels in the third plane of image

1 次查看(过去 30 天)
Hi, I'm new to Matlab can you help me figuring out how to solve these two questions?. how can I display how many pixels in the third plane of the image is greater than 150. Do I need to use nested for loop to count them? or there is an easier way to do that. another question if I want to display the minimum value in the second plane of the image on the screen.is this right?
% x= imread('image.jpg');
min(min(x(:,:,2)))

采纳的回答

KSSV
KSSV 2017-5-30
I = imread('peppers.png') ;
R = I(:,:,1) ;
G = I(:,:,2) ;
B = I(:,:,3) ;
%%pixels in B greater then 150
[y,x] = find(B>150);
figure(1)
imshow(B) ;
hold on
plot(x,y,'.r')
%%minimum value in G
[val,idx] = min(G(:)) ;
[i,j] = ind2sub(size(G),idx) ;
figure(2)
imshow(G) ;
hold on
plot(i,j,'*r')

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by