Ask Your Question
0

OpenCV convexhull points coordinates

asked 2016-07-26 04:00:31 -0500

danaro gravatar image

Hello, I'm trying to get all the points coordinates (X and Y position) of a hull which the program finds.

For instance, if a rectangular hull is found, all of his bounding points (which are drawn by the cvdrawcontours and convex hull functions) will be printed out on the screen so all the drawn convex hull is transferred to coordinates of points that build it.

Thank you, Dan.

edit retag flag offensive close merge delete

Comments

Where exactly is your problem in getting the convex hull points? The OpenCV function convexHull() will give you an array of the points. Have a look at the documentation: Documentation

Missing gravatar imageMissing ( 2016-07-26 04:36:11 -0500 )edit

That is right but I want to extract the coordinates of the points in this array and print them on acreen as I described above, how can I do it?

danaro gravatar imagedanaro ( 2016-07-26 05:41:10 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2016-07-26 05:46:57 -0500

Some remarks

  • cvdrawcontours suggests you are using the old API. Skip it, move away and go to the C++ variants. The C-API was declared deprecated ages ago!
  • Your convex hull is a vector<points>, each having their X and Y coordinate. So it is simply a task of looping over the convex hull points, and calling attribute X and Y of each point. That cannot be to difficult right?
  • Printing on screen can be done using standard C++ library with cerr or cout functions.
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-07-26 04:00:31 -0500

Seen: 346 times

Last updated: Jul 26 '16