A Hog-based broadcast detector cannot detect a single face or even a person. According to peopledetect.cpp in OpenCV examples, I am trying to detect people, but not get what I am missing here. Following the code I'm trying to do:
#include "cvaux.h"
#include "highgui.h"
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat img;
FILE* f = 0;
char _filename[1024];
if( argc == 1 )
{
printf("Usage: peopledetect (<image_filename>\n");
return 0;
}
img = imread(argv[1]);
if( img.data )
{
strcpy(_filename, argv[1]);
}
HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
for(;;)
{
char* filename = _filename;
printf("%s:\n", filename);
if(!img.data)
continue;
fflush(stdout);
vector<Rect> found, found_filtered;
double t = (double)getTickCount();
hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2);
cout<<found.size()<<endl;
t = (double)getTickCount() - t;
printf("tdetection time = %gms\n",t*1000./cv::getTickFrequency());
size_t i, j;
for( i = 0; i < found.size(); i++ )
{
Rect r = found[i];cout<<i<<endl;
for( j = 0; j < found.size(); j++ )
if( j != i && (r & found[j]) == r)
break;
if( j == found.size() )
found_filtered.push_back(r);
cout<<found_filtered.size()<<endl;
}
imshow("people detector", img);
int c = waitKey(0) & 255;
}
return 0;
}
No picture is revealed for anything. What could be the problem? Am I not linking something?
source
share