February 25, 2020 - Splitting Contour Via Nearby Points Part 2

Lab Work

Today, I continued to try and split the contour seen in this image (the green contour to the left):

segmentation_result_162.PNG

in order to measure each egg in the contour separately.

Yesterday, I think I took a step in the right direction in finding a way to split the contour by taking into consideration the points nearby the convexity defect points (seen in this post).

I tried to continue using a variation of this method today to see if I could make any more progress on the separation of the contour. This time, I tried to find nearby points at varying distances from the central point (seen in the image below):

multiple_points_162.PNG (varying distances are represented through the black points)

I found the slopes of the points of different distances (slope of black and blue point), and subsequently found lines that correlated to these points in order to find an intersection point in between these two lines (seen in the image below) :

intersection_162.PNG (intersection point represented by black dot and lines represented as white lines connected to the black dot)

From there, I found the line between the intersection point and the original convexity defect point in order to create a line segment that goes through the segment of interest. I tried a number of different distances, which lead to different results (seen below):

first attempt (n = 21)

split_contour_try1_162

second attempt (n = 20)

split_contour_try2_162.PNG

third attempt (n = 19)

split_contour_try3_162.PNG

This result seems promising, so I will continue to try and use this method to try and separate the contour.

Sources I used:

How can I check if two segments intersect?

Sources that I think will be useful for next step:

Creating your own contour in opencv using python


Next Step

Try and actually split the contour into individual eggs given the line information generated

Written on February 25, 2020