1 | initial version |

OpenCV expects a contour to be a list of points of connected pixels, in which the starting point is the top-most one (with lowest Y coordinate). Then, each point on the list has to be connected with the previous one in a counter-clockwise fashion.

Imagine a circle defined as list of points: the top-most point (lowest Y coordinate) is number one in the list, then follows each point in a counter-clockwise fashion.

Priority goes like this:

Number 1 in list -> top-most point (lowest Y coordinate pixel) Number n in the list -> connected to the n-1 pixel with the following priority:

- Lower X coordinate compared to previous point
- Higher Y coordinate compared to previous point
- Higher X coordinate compared to previous point
- Lower Y coordinate compared to previous point

2 | No.2 Revision |

OpenCV expects a contour to be a list of points of connected pixels, in which the starting point is the top-most one (with lowest Y coordinate). Then, each point on the list has to be connected with the previous one in a counter-clockwise fashion.

Imagine a circle defined as list of points: the top-most point (lowest Y coordinate) is number one in the list, then follows each point in a counter-clockwise fashion.

Priority goes like this:

Number 1 in list -> top-most point (lowest Y coordinate ~~pixel)
~~pixel)

Number n in the list -> connected to the n-1 pixel with the following priority:

- Lower X coordinate compared to previous point
- Higher Y coordinate compared to previous point
- Higher X coordinate compared to previous point
- Lower Y coordinate compared to previous point

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.