Number of ones
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
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)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!