How to calculate sum of black pixel in binary image?

6 次查看(过去 30 天)
I need to find sum of all black pixels present in my input image. How can I do it in simple way thanks in advance

采纳的回答

Image Analyst
Image Analyst 2016-3-9
Try this:
numBlackPixels = sum(yourImage == 0);
  5 个评论
mohd akmal masud
mohd akmal masud 2019-8-1
编辑:Image Analyst 2019-8-2
Yes, i just want to know how many white pixels are in the red circle. If i use your code
props = regionprops(binaryImage, 'Area');
allAreas = [props.Area]
it calculates the white pixel area for all blobs right?
Image Analyst
Image Analyst 2019-8-2
Yes, that's correct.
Let's say you have a bunch of blobs scattered around the image randomly. How are you going to tell MATLAB which blob you want? Is it always the left-most blob? Or the bottom-most blob? Or the one closest to the lower left corner? Or is it always the largest blob? Or do you want to click on one with ginput()?
Exactly how is the code supposed to know which of the bunch of blobs is the one you're thinking about?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by