필터 지우기
필터 지우기

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 (최근 30일)
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

답변 (2개)

Image Analyst
Image Analyst 2012년 4월 13일
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))

Andrei Bobrov
Andrei Bobrov 2012년 4월 13일
[MaxNumOnesRow,indexRow] = max(sum(binaryImage,2))

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by