February 19, 2020 - A step closer to figuring out how to split the contour?
Today, I continued to try and split the contour seen in this image:
in order to measure each of the eggs separately.
Sources that I used that were helpful:
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):
and I was also able to find the best-fit ellipse around it:
I think a possible way to separate the contour would be to:
- find the convexhull for the contour of interest
- find the convexity defects for the contour of interest
- make a distance threshold between the convexhull and convexity defects points
- make a distance threshold between the convexity defects themselves
- make a bounding box/ellipse around the contour of interest
- 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.
Continue to figure out how to separate the contour
Written on February 19, 2020