DaHoC / trainHOG

Example program showing how to train your custom HOG detector using openCV
221 stars 109 forks source link

Running the classifer #17

Open snehalvartak opened 7 years ago

snehalvartak commented 7 years ago

How do I test the classifier once it has been compiled as per the steps mentioned in the tutorial?

chrisHuxi commented 5 years ago

How do I test the classifier once it has been compiled as per the steps mentioned in the tutorial?

after training you can get "cvHOGClassifier.yaml" in the genfile. the you can load it with : hog.load("cvHOGClassifier.yaml") here is an example:

cv::Mat gray_image;
cv::cvtColor(res_image, gray_image, cv::COLOR_BGR2GRAY);
cv::HOGDescriptor hog;  
hog.load("cvHOGClassifier.yaml");
std::vector<cv::Rect> found, found_filtered;
hog.detectMultiScale(gray_image, found, 1.3, cv::Size(2,2), cv::Size(4,4), 1.05, 10);