CUDA_TEST_P(CalTech, HOG) { cv::cuda::GpuMat d_img(img); cv::Mat markedImage(img.clone()); cv::Ptr<cv::cuda::HOG> d_hog = cv::cuda::HOG::create(); d_hog->setSVMDetector(d_hog->getDefaultPeopleDetector()); d_hog->setNumLevels(d_hog->getNumLevels() + 32); std::vector<cv::Rect> found_locations; d_hog->detectMultiScale(d_img, found_locations); #if defined (LOG_CASCADE_STATISTIC) for (int i = 0; i < (int)found_locations.size(); i++) { cv::Rect r = found_locations[i]; std::cout << r.x << " " << r.y << " " << r.width << " " << r.height << std::endl; cv::rectangle(markedImage, r , CV_RGB(255, 0, 0)); } cv::imshow("Res", markedImage); cv::waitKey(); #endif }
GPU_TEST_P(CalTech, HOG) { cv::gpu::GpuMat d_img(img); cv::Mat markedImage(img.clone()); cv::gpu::HOGDescriptor d_hog; d_hog.setSVMDetector(cv::gpu::HOGDescriptor::getDefaultPeopleDetector()); d_hog.nlevels = d_hog.nlevels + 32; std::vector<cv::Rect> found_locations; d_hog.detectMultiScale(d_img, found_locations); #if defined (LOG_CASCADE_STATISTIC) for (int i = 0; i < (int)found_locations.size(); i++) { cv::Rect r = found_locations[i]; std::cout << r.x << " " << r.y << " " << r.width << " " << r.height << std::endl; cv::rectangle(markedImage, r , CV_RGB(255, 0, 0)); } cv::imshow("Res", markedImage); cv::waitKey(); #endif }