Ask Your Question
0

How can I access each elements of an one contour?

asked 2017-07-25 05:33:12 -0600

ibrahim_5403 gravatar image

updated 2017-07-25 05:33:56 -0600

i am new in OpenCV. I have the following problem. suppose I retrieved a contour from image. It is look like this: square[0] and the size of square[0] is [1×4]. suppose the elements are look like this: [2,3;4,5;6,7;1,2]

How can I access each element. As for example How can I retrieve only 2?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2017-07-25 09:11:50 -0600

berak gravatar image

a contour is a vector<Point> points, you access it's 2nd element by points[1], the coords are int x = points[1].x and int y = points[1].y

(what's so difficult about it ?)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-25 05:33:12 -0600

Seen: 914 times

Last updated: Jul 25 '17