Sorry, this content is no longer available

Ask Your Question
1

Grouping different scale bounding boxes

asked Apr 14 '13

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?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Apr 15 '13

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.

Preview: (hide)

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 (Apr 15 '13)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 (Apr 15 '13)edit
1

That did the trick :) thank you very much

Pedro Batista gravatar imagePedro Batista (Apr 15 '13)edit

You are welcome!

StevenPuttemans gravatar imageStevenPuttemans (Apr 15 '13)edit

Question Tools

Stats

Asked: Apr 14 '13

Seen: 597 times

Last updated: Apr 15 '13