How to divide a contour futher into shapes

asked 2017-10-26 11:27:59 -0600

This is the picture of a pole along with the hoop, these together form a ring, image description What i want to do is that, i do not want to realize the entire figure as a single contour but rather segment it into two parts, that is a circle and a rectangle.But when i try to draw a contour, it does not recognize as blue as different and does treat it as the same color and hence it draws it as a same contour. So how do i divide the the contour into two types from a single contour with different centers and moments?

edit retag flag offensive close merge delete

Comments

1

Have you considered HoughLines() and HoughCircles()? Think that should work.

tomasth gravatar imagetomasth ( 2017-10-26 17:26:39 -0600 )edit

Another possible way would be to divide the entire contour in two halves for top and bottom. The bottom half (if vertical) will have a low aspect ratio (wd/ht). Move the dividing line up one pixel at a time until the aspect ratio changes.

Another way would be to fit a line to the bottom contour. Then use line iterator to step along the pole until the hoop is found.

Chris gravatar imageChris ( 2019-04-24 14:30:08 -0600 )edit