Extract the coordinates of a point OpenCV C + + [closed]

asked 2014-03-06 02:45:54 -0500

zowpro gravatar image

updated 2014-03-06 03:16:11 -0500

berak gravatar image

Hello,

I want to extract a specific point in vector

vector <vector <Point>> contours_poly (contours.size ());

but I could not extract its coordinates (X and Y) because I used matrices. Here is my code:

 vector<vector<Point> > contours;
 vector<vector<Point> > contours_poly( contours.size() );
 for(size_t i = 0; i < contours.size(); i++ )
 {
      approxPolyDP( Mat(contours[i]), contours_poly[i], 2, true ); 
 }

Merci.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2016-01-04 22:47:10.907677

Comments

what goes wrong ?

berak gravatar imageberak ( 2014-03-06 03:14:59 -0500 )edit

I can't extract the coordinates of a specific point(the X and the Y) of my vector "contours_poly"

zowpro gravatar imagezowpro ( 2014-03-06 03:25:53 -0500 )edit
2

X = contours_poly[ contour_id ][ point_id ] .x;

(note, that the contours_poly vectors will have less points than the original contour due to the approx.)

berak gravatar imageberak ( 2014-03-06 03:36:40 -0500 )edit

Thanks a lot :D

zowpro gravatar imagezowpro ( 2014-03-06 04:39:36 -0500 )edit