Displaying how many pixels in the third plane of image

1 Ansicht (letzte 30 Tage)
SAMIA ALGHAMDI
SAMIA ALGHAMDI am 30 Mai 2017
Beantwortet: KSSV am 30 Mai 2017
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)))

Akzeptierte Antwort

KSSV
KSSV am 30 Mai 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')

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by