Number of ones

5 次查看(过去 30 天)
Santhosh S
Santhosh S 2012-4-13
counting number of ones occured in labelled binary image for specific rows and storing the values in a vector like number of ones in x row

回答(2 个)

Andrei Bobrov
Andrei Bobrov 2012-4-13
out = sum(BW,2)

Image Analyst
Image Analyst 2012-4-13
Try this:
% Create a sample binary image.
binaryImage = logical(randi(2, [5 7])-1)
% Count the ones in each row.
numberOfOnesPerRow = 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