0
votes

For a OpenCV driving assistance application I want to generate ROIs as candidates for faster HoG classification of pedestrians. I'm running this on GPU. I do not want to use detectMultiscale function as it scan all over the image (including sky). Since the features are not scalable, which of the following functions I should use for resizing the images for generating the ROIs?

gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR, Stream& stream=Stream::Null()) or

Image pyramids cv2.pyrUp(), cv2.pyrDown()

I couldn't find image pyramids in OpenCV GPU library(2.4.9).

Can anyone please suggest?

Thanks

1

1 Answers

3
votes

First, you could directly set a ROI by using the cvRect (opencv rectangle) function to create the ROI image/submatrix, like that:

Mat image = imread("");
Rect region_of_interest = Rect(x, y, w, h);
Mat image_roi = image(region_of_interest);

But if you want to generate lowsamples smaller (less lines and columns), there are some differences between pyramids and resize:

-Pyramids are a kind of filter done by a convolution of all image with a gaussian convolution matrix, and after that it downsamples the image by rejecting even rows and columns.

-The resize function, do a geometric transformation and you could change the method to interpolate the pixel values.

in pratice: pyramids are a quick way to downsample by 4 sub-images; resize are more generic and could be used for upsampling too.