February 19, 2020 - A step closer to figuring out how to split the contour?

Lab Work

Today, I continued to try and split the contour seen in this image:

segmentation_reduced_threshold.PNG

in order to measure each of the eggs separately.

Sources that I used that were helpful:

  1. Contours : More Functions

  2. Contour Features

I think I got a better understanding of how convexhull and convexity defects work in OpenCV, and was able to produce these points (red is the convexhull points and teal is the convexity defect points):

hull&defect.PNG

and I was also able to find the best-fit ellipse around it:

ellipse.PNG

I think a possible way to separate the contour would be to:

  1. find the convexhull for the contour of interest
  2. find the convexity defects for the contour of interest
  3. make a distance threshold between the convexhull and convexity defects points
  4. make a distance threshold between the convexity defects themselves
  5. make a bounding box/ellipse around the contour of interest
  6. find angle of the bounding box/ellipse
    • if the angle of two convexity defect points within a certain distance threshold is within a certain range, then connect those points.
    • for clusters that go all the way around in a circle, find angle range between horizontal and vertical axes

I will have to test this method to see if it is a viable way to separate the contour.


Next Steps

Continue to figure out how to separate the contour

Written on February 19, 2020