Ask Your Question
1

Grouping different scale bounding boxes

asked 2013-04-14 17:26:53 -0600

I've created an openCV application for human detection on images.

I run my algorithm on the same image over different scales, and when detections are made, at the end I have information about the bounding box position and at which scale it was taken from. Then I want to transform that rectangle to the original scale, given that position and size will vary.

I've wrapped my head around this and I've gotten nowhere. This should be rather simple, but at the moment I am clueless.

Help anyone?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2013-04-15 02:08:28 -0600

What you should do is store the scale where you are at for each detection. Then transforming should be rather easy right. Imagine you have the following.

X and Y coordinates (center of bounding box) at scale 1/2 of the original. This means that you should multiply with the inverse of the scale to get the location in the original, which would be 2X, 2Y (again for the bounxing box center).

So first transform the center of the bounding box, than calculate the width and height of your bounding box in the original, again by multiplying with the inverse. Then from the center, your box will be +-width_double/2 and +-height_double/2.

edit flag offensive delete link more

Comments

Didn't try your solution yet, but wouldn't that work for any other point of the rectangle other than the centroid?

Pedro Batista gravatar imagePedro Batista ( 2013-04-15 09:05:16 -0600 )edit

It is basic math, so yes, you could go from any other typical point. Like the upperleft or upper right corner for example. Write it down on a sheet :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-15 09:27:42 -0600 )edit
1

That did the trick :) thank you very much

Pedro Batista gravatar imagePedro Batista ( 2013-04-15 10:29:03 -0600 )edit

You are welcome!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-15 10:30:49 -0600 )edit

Question Tools

Stats

Asked: 2013-04-14 17:26:53 -0600

Seen: 554 times

Last updated: Apr 15 '13