Uncertanity in counting the number of a pixel in a binary image

1 view (last 30 days)
I am trying to find the error in my measurement which is calculating the surface area of different objects.
Using "regionprops" I can count the number of black pixels (or 0) in a binary image. This number (I guess) depends on the threshold of the "im2bw" function. What happens to the pixels at the edge of the objects? Do they convert to 1 or 0? Is there a way to figure out how many edge pixels have not counted (which were supposed to be counted in reality) and how many are counted (which were not supposed to)? In short, I am trying to find the error in counting pixels! How many pixels are in a closed boundary in an image how many I get after I process the image!
Hope I am clear enough!
  2 Comments
Rik
Rik on 31 Oct 2017
regionprops only works on binary data. This means that it indeed depends on the method you use to convert your image to binary. If edge pixels should have been counted, it sounds like you need to adjust the conversion.
Matt J
Matt J on 31 Oct 2017
Is there a way to figure out how many edge pixels have not counted (which were supposed to be counted in reality) and how many are counted (which were not supposed to)?
Only if you have ground truth prior knowledge of which pixels were supposed to be counted.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 1 Nov 2017
"What happens to the pixels at the edge of the objects? Do they convert to 1 or 0?" That depends on if they were above or below the threshold. The threshold depends on the algorithm chosen and of course if the threshold changes, the number of white and black pixels in the binary image changes. Like Matt said, the only way to know if it's thresholding the image accurately is if you know for certain which way every pixel is supposed to be: 0 or 1. If you don't know that, then who's to say if it's right or wrong? No one.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!