Ask Your Question

Revision history [back]

If your objects appear in a fixed position I would follow these steps

  1. Given both contours, check which one is right and which one is left, by looking at the x coordinate of center
  2. Now for the left contour, look at all the points of your contour (loop over them) and pic the x coordinate which is smallest on the x axis compared to center.
  3. Do the opposite for the second contour, looking for the largest x value, and thus the point most to the right