I'm trying to get the people detector provided by the OpenCV library running. So far I get decent performance on my iPhone 6 but the detection is super bad and almost never correct and I'm not really sure why this is since you can find example videos using the same default HOG descriptor with way better detection.
Here is the code:
- (void)processImage:(Mat&)image { cv::Mat cvImg, result; cvtColor(image, cvImg, COLOR_BGR2HSV); cv::vector<cv::Rect> found, found_filtered; hog.detectMultiScale(cvImg, found, 0, cv::Size(4,4), cv::Size(8,8), 1.5, 0); size_t i; for (i=0; i < found.size(); i++) { cv::Rect r = found[i]; rectangle(image, r.tl(), r.br(), Scalar(0,255,0), 2); } } The video input comes from the iPhone camera itself and "processImage:" is called for every frame. For the HOGDescriptor I use the default people detector:
_hog.setSVMDetector(cv::HOGDescriptor::getDefaultPeopleDetector()); I appreciate any help. :)
cvtColor(image, cvImg, COLOR_BGR2HSV);and try again.hog.detectMultiScale(image...OpenCV Error: Assertion failed (img.type() == CV_8U || img.type() == CV_8UC3) in computeGradient