Ask Your Question
2

Contributing to Feature #3073: Convenient way of initializing RotatedRect

asked 2014-02-14 02:55:56 -0600

rohitg gravatar image

updated 2014-02-14 02:59:46 -0600

Hi! I am trying to build this initializer for RotatedRect as mentioned in a feature request here. Wanted to take feedback before I sent a PR.

Essentially, I take 3 points and derive the center, angle and side lengths using those. I assume the points to be in order (clockwise/anticlockwise), hence center is the mean of first and last points. I find the 2 vectors (corresponding to the 2 edges), and surely one of the vectors must have slope between 1 and -1. That vector (and corresponding edge) becomes our width, and hence the other becomes height. A patch is here.

Please let me know if there are issues with the implementation.

PS: Am really a noob, feel free to pick nits! Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-03-03 20:40:40 -0600

rohitg gravatar image

Just to close the question. I sent a PR (https://github.com/Itseez/opencv/pull/2358) and it was accepted :)

Thanks @SpecLad !

edit flag offensive delete link more

Comments

Thanks for PR!

Daniil Osokin gravatar imageDaniil Osokin ( 2014-03-04 00:26:47 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-02-14 02:55:56 -0600

Seen: 346 times

Last updated: Mar 03 '14