First time here? Check out the FAQ!

Ask Your Question
0

OpenCV convexhull points coordinates

asked Jul 26 '16

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.

Preview: (hide)

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 (Jul 26 '16)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 (Jul 26 '16)edit

1 answer

Sort by » oldest newest most voted
3

answered Jul 26 '16

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.
Preview: (hide)

Question Tools

1 follower

Stats

Asked: Jul 26 '16

Seen: 851 times

Last updated: Jul 26 '16