RotatedRect to Point2f vertices[4]

238 views
Skip to first unread message

Dinh Thap

unread,
Apr 18, 2016, 7:56:32 AM4/18/16
to javacv
Hello everyone, I'm a JavaCV newbie. Now, I want to draw line over 4 vertices of rotated rect. I stuck in step get vertices[4] from rotated rect. So I need a help. Thank everyone.

Dinh Thap

unread,
Apr 18, 2016, 1:14:24 PM4/18/16
to javacv
I saw in source code opencv_core.RoatatedRect and it has function points(Point[] points), but when I integrated javacv 1.1, javacpp 1.1 and opencv 3.0.0 RotatedRect has function points(Point2f pts). Why?. Please explain for me. Thank so much.

Samuel Audet

unread,
Apr 23, 2016, 5:43:20 AM4/23/16
to jav...@googlegroups.com, Dinh Thap
Point2f derives from FloatPointer, which has functionality for dealing
with native arrays, so we can access the 4 points you're interested in
this way, for example:

Point2f vertices = new Point2f(4);
rotatedRect.points(vertices);
float[] coordinates = new float[8];
vertices.get(coordinates);

Samuel
Reply all
Reply to author
Forward
0 new messages