How to divide a contour futher into shapes
This is the picture of a pole along with the hoop, these together form a ring, 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?
Have you considered HoughLines() and HoughCircles()? Think that should work.
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.