cv::findContours Orientation

asked 2017-08-03 16:01:54 -0600

Eric_1 gravatar image

Hello,

Are the contours returned by cv::findContours guaranteed to always have a consistent orientation? Is there any proof or documentation you can point to? Using version 2.4.5.

Thanks in advance!

edit retag flag offensive close merge delete

Comments

What is consistent orientation ? and 2.4.5 please uptdate to 2.4.13.2 or opencv 3.3.0-rc

LBerger gravatar imageLBerger ( 2017-08-04 04:30:12 -0600 )edit

Hello LBerger,

Thanks for the quick response. Please see below.

'I am using OpenCV's cv::findContours function to extract contours in a binary image, in particular, I'm extracting a hierarchy of contours (using the CV_RETR_CCOMP flag). At some point in my further processing of those contours I need to rely on a consistent vertex orientation of these contours (i.e. counter-clockwise vs. clockwise).

Of course I can just determine that orientation myself using the sign of the contour's area (as computed by cv::contourArea(..., true)), but I wonder if that is even necessary (besides that, it won't even work for contours with an area of 0, i.e. thin lines in the source image) or if cv::findContours already guarantees a consistent orientation for the generated contours.'

Eric_1 gravatar imageEric_1 ( 2017-08-04 07:25:53 -0600 )edit

I think answer is in this paper reference given here

LBerger gravatar imageLBerger ( 2017-08-04 07:36:30 -0600 )edit

Hello LBerger,

Thank you! Any particular line you can point out, please?

Best, Eric

Eric_1 gravatar imageEric_1 ( 2017-08-04 07:37:52 -0600 )edit

May be in appendix 1 step 1 and 4

LBerger gravatar imageLBerger ( 2017-08-04 07:46:21 -0600 )edit