Ask Your Question
0

Drawing Bounding Box for a rotated object

asked 2016-11-03 09:14:27 -0500

ramanan1991 gravatar image

Hi guys

I have a video stream where the objects( boxes) move in any direction and in any pose. I want to track each and every object. So this is what i did with OpenCV:

1) I found the contours of the object

2) drew bounded boxes around the objects.

3) Calculated the centroid of the bounded box and tracked the objects.

All these works fine. But the centroid of the bounded box is not exactly equal to the center of the object when the object rotates or is in some other pose.

I want the bounded box also to rotate and fit to the shape of the box. When this happens the center of the bounded box is equal to the center of the object. This will also improve my tracking accuracy.

See the picture attached:

image description

If Bounded box is not a solution, is there any there method to find the center of the object

My object is always box shaped and also only the top surface of the object is seen on the video stream.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2016-11-03 10:34:19 -0500

This question is probably more appropriate for http://answers.opencv.org/questions/ , but as I recently needed this too, here's a quick hint: minAreaRect should fit very well for your use case. Just feed it a few points from the detected contours and you should get the rotated rectangle you seek.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-03 09:14:27 -0500

Seen: 1,355 times

Last updated: Nov 03 '16