Ask Your Question
0

Would like to use different scales with HOG people detection

asked 2015-10-28 17:01:33 -0600

jkutchk gravatar image

I think the default scaling for OpenCV's HOG implementation is 1.05 raised to some power, where that power is a value from 1 to nlevels(which is 64) . I'd like to skip the lower scales (1.05^1 - 1.05^13) and start at 1.05^14. I know I can enter 1.05^14 into detectMultiScale as the value for scale0, but then HOG would use powers of 1.05^14 rather than 1.05. How can I use the HOG implementation such that I use scales 1.05^14 - 1.05^54, thereby skipping the lower scales?

Thanks, --jkutchk

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-10-29 03:43:21 -0600

Siegfried gravatar image

Hi. To skip the first scales you can downscale the image before running detectMultiScale using resize method.

//assuming img is your input image

// 1. compute scale
const double scale = pow(1.05,13); // scale factor per level = 1.05 and 13 levels to skip
cv::Mat smallerImg;

// 2. compute downscaled roi
const cv::Size sz(cvRound(img.cols/scale), cvRound(img.rows/scale));

// 3. resize image to downscaled roi
resize(img, smallerImg, sz);

// 4. run detectMultiScale
edit flag offensive delete link more

Comments

This works good. There is a problem with the resulting found_locations vector of rectangles though, but for my purposes it's fine.

jkutchk gravatar imagejkutchk ( 2015-11-07 13:16:42 -0600 )edit

Hi. Can you tell us please whats the problem with the found locations? The found locations are in relation to the downscaled image. If you want the locations in relation to the input image you have to upscale the found locations (position and size) by the scale factor scale.

Siegfried gravatar imageSiegfried ( 2015-11-07 16:23:01 -0600 )edit

The problem was that the found locations were for the down-scaled image. I think most people would need found locations for the input image as you mentioned.

jkutchk gravatar imagejkutchk ( 2015-11-07 16:27:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-10-28 17:01:33 -0600

Seen: 285 times

Last updated: Nov 07 '15