Last active
October 2, 2017 18:43
-
-
Save MareArts/e26e24b9c4e2774222e59ba6f360bb1e to your computer and use it in GitHub Desktop.
ICF(Integral Channel Features) + WaldBoost example (opencv, ICFDetector uses example) - step3 (detection part)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
cv::xobjdetect::ICFDetector icf_detector; | |
// model loading | |
cv::FileStorage cvfs("icf_model.txt", cv::FileStorage::READ); | |
icf_detector.read(cvfs["icf"]); | |
// test image | |
std::string img_file = "pp.jpg"; | |
cv::Mat img = cv::imread(img_file); | |
// image detect | |
std::vector < cv::Rect > objs; | |
std::vector < float > values; | |
icf_detector.detect(img, objs, 1.2, cv::Size(128, 128), cv::Size(256, 256), 8.0, 20, values); | |
char TestStr[100]; | |
// rect draw | |
for (int i = 0; i < objs.size(); ++i) | |
{ | |
rectangle(img, objs[i], Scalar(255, 0, 0)); | |
sprintf_s(TestStr, "%0.2lf", values[i]); | |
//check score | |
printf("[%d] = %lf\n", i, values[i]); | |
putText(img, TestStr, Point(objs[i].x, objs[i].y), CV_FONT_NORMAL, 1, Scalar(255, 255, 255), 1); //OutImg is Mat class; | |
} | |
namedWindow("test", 0); | |
imshow("test", img); | |
waitKey(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment