Ask Your Question

aamirkhan's profile - activity

2013-06-25 05:12:51 -0600 asked a question help with the hog detector

Hi,

I am new to opencv and has recently been working on a small project where i need to deal with the HOG detector provided by the opencv. I have to extract the HOG detected window image out of the original image for which one possible approach i have tried is to create an image of Mat type and saving it with the exact width and height, x,y coordinates which are being calculated for the detected window. The approach works but the problem is it get crashes after while. Any help in this regards, some of the code chunk is given below. Thanks for any help in advance.

cv::Mat portionOfImage;
Rect r;
for (i=0; i<found_filtered.size(); i++) 
{
     r = found_filtered[i];
     r.x += cvRound(r.width*0.1);
     r.width = cvRound(r.width*0.8);
     r.y += cvRound(r.height*0.07);
     r.height = cvRound(r.height*0.8);
     rectangle(img, r.tl(), r.br(), Scalar(0,255,0), 3);        
}
portionOfImage = img(r);
imshow("opencv", portionOfImage);