Ask Your Question
1

Why is a contour from cv2.findContours() in a shape like [N,1,2]?

asked 2020-09-28 00:13:53 -0600

Eric Song gravatar image

updated 2020-09-28 01:02:41 -0600

berak gravatar image

Hi, guys,
I am a learner of OpenCV, and I found the returned contours from cv2.findContours() are in a a shape like [N,1,2]?
And I want to know why not using the shape as [N,2]?
What is the reason for the middle dimension?

Any idea or answer will be appreciated!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-09-28 03:09:56 -0600

berak gravatar image

opencv is a c++ library, the automatically generated python wrappers have some oddities...

since a std::vector<Point> has to be the equivalent of a cv::Mat(N,1,CV_32SC2) (a 2d matrix !) in c++, you'll get it translated like this into python

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-09-28 00:13:53 -0600

Seen: 241 times

Last updated: Sep 28 '20