First time here? Check out the FAQ!

Ask Your Question
0

X any Y coordinates of my contours [closed]

asked Oct 11 '13

lobi gravatar image

updated Oct 11 '13

berak gravatar image

Hello,

how can I get X and Y coordinates of my contours object in Java?

Thanks.

Preview: (hide)

Closed for the following reason duplicate question by Rui Marques
close date 2014-02-25 16:10:40.327701

Comments

1 answer

Sort by » oldest newest most voted
0

answered Feb 25 '14

Will Stewart gravatar image

updated Feb 25 '14

For each contour, you can obtain a boundingRectange, which you can then get the top left and bottom right x,y coordinates. Be mindful that the tl and br might actually represent tr and bl corners!

You can then extract the bounding rectangle center based on these coordinates.

Note that a bounding rectangle center may not be the centroid of the contour (indeed, it would rarely be exactly the same and might be significantly different, especially with concave contours that are crescent-like).

If you mean x,y as in ground-plane, that is a more involved answer concerning finding a homography and performing a perspective transformation.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Oct 11 '13

Seen: 2,129 times

Last updated: Feb 25 '14