Contour left of right?
Is there any method on earth that based on these contours, I know that the A contour is on the right of B contour? or vise versa as in the picture? I had been playing with the centroids and coordinate and it does not make sense so far from the result.
There is an idea that I think which is to draw a line base on the centroid at 45 degree toward (0,0) for both centroid and look at the y value crossing.
The question is how can I draw a line from a given centroid at 45 degree and manage to get the crossing point on Y axis. If looking at the first picture, it will not cross Y axis. AM I right? So mybe my idea is not working too.
Your idea seems too complicated. It is easy to find the most left, right, top and bottom points of a given contour. Once you have retrieved them, you can apply rules to order your contours with sort() function. Check this post
i think this may be a clue.check deg value
First you need to define the labels of the contours, like B the small one and A the big one (like in your image), this you can get by contourArea, or using arcLength, then you need to sort the contours from left to right, and here you need to define what left means (based on the centroid, base on the x or y coordinates of its points, or any other criteria)