how to extract pixels from a image {black and white only }
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    

I want to extract pixels  [black and white ] above image ,how to get it ? and give me answer below questions ? Thanks Advance .........
1. find the horizontally number of ON pixels in each row..?[on=white pixels]
2. find the horizontally number of OFF pixels in each row and column as well..?[off=black pixels]
3. Plot the histogram in y direction for the ON pixel
4 how to display histogram for that pixels only .......
0 comentarios
Respuestas (1)
  Voss
      
      
 el 28 de Mayo de 2022
        data = imbinarize(rgb2gray(imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/160786/image.jpeg')));
% 1. find the horizontally number of ON pixels in each row..?[on=white pixels]
n_white_per_row = sum(data,2)
% 2. find the horizontally number of OFF pixels in each row and column as well..?[off=black pixels]
n_black_per_row = sum(~data,2)
n_black_per_column = sum(~data,1)
% 3. Plot the histogram in y direction for the ON pixel
barh(n_white_per_row,'EdgeColor','none','BarWidth',1)
set(gca(),'YDir','reverse','YLim',[0.5 size(data,1)+0.5])
% 4 how to display histogram for that pixels only .......
% I don't know what "that" means.
0 comentarios
Ver también
Categorías
				Más información sobre Histograms en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


