Displaying how many pixels in the third plane of image
1 view (last 30 days)
Show older comments
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)))
0 Comments
Accepted Answer
KSSV
on 30 May 2017
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!