Distinguish between line and dot

1 view (last 30 days)
Andraz Skoda
Andraz Skoda on 20 Jun 2016
Commented: Sam Zorch on 22 Jun 2016
Hello to everyone.
I have to distinguish between line and dot structures in binary image. Below, you can see binary image with two dots and one line. I'm looking for a way to calculate the shape of this three structures. I mean with that if there is a structure in binary image that is more like dot, then it should be marked as dot (for example with green color), and if there is a structure more like line, it should be marked as line(for example like red color).
Binary picture:
I already know how to calculate the number of structures and cordinates of central pixels with regionprops().
I would be very thankfull for any help here!
Andraz
  1 Comment
Sam Zorch
Sam Zorch on 22 Jun 2016
If regionprops is finding the objects correctly, then you can also ask it for the 'Eccentricity' property. It will be 0 for a perfect circle and 1 for a straight line. I'm getting a surprisingly high value of 0.69 for the left-most object in your example image, so it may take a little trial and error to set a threshold value that separates dots from lines.
Small objects may cause problems, so you might throw in some additional constraints. For example, perhaps the 'MajorAxisLength' has to be greater than a certain value for the object to be considered a line.
If your binary image came from thresholding grayscale values, you could also do your own center of mass analysis for each region, using the intensity of each pixel as the mass of a corresponding point particle. If the objects are on a quiet dark background, you could dilate each BW region a bit before using it to mask the grayscale image, to make sure you've covered the entire object.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!