count number of ones occurred in a row/column in an binary image and storing the values of counting in row/column wise in a matrix
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How to count number of ones occurred in a row/column in an binary image and to know which row/column has max ones occured in matlab and row/column by row/column storing total ones occured in a row/column in an vector
0 comentarios
Respuestas (2)
Image Analyst
el 13 de Abr. de 2012
Try this:
% Create a sample binary image.
binaryImage = logical(randi(2, [8 7])-1)
% Count the ones in each row.
numberOfOnesPerRow = sum(binaryImage, 2) % Change to 1 for columns
[maxValue, indexes] = find(numberOfOnesPerRow == max(numberOfOnesPerRow))
0 comentarios
Andrei Bobrov
el 13 de Abr. de 2012
[MaxNumOnesRow,indexRow] = max(sum(binaryImage,2))
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox 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!