資源簡介
利用Opencv3.2中的DPM模塊,實現DPM算法對行人的檢測,一個完整的實現,含有注釋和完整的工程文件,環境為win7+vs2013
代碼片段和文件信息
//??基于HOG特征的行人檢測
//??2017-9-01
//??基于HOG特征的行人檢測??
//??Author:www.icvpr.com
//??Blog:??http://blog.csdn.net/icvpr??
#include?
#include?
#include?
#include???
using?namespace?std;
using?namespace?cv;
int?main()
{
cv::Mat?image;
char?pathAndFileName[40];
char?outputpathAndFileName[40];
//?1.?定義HOG對象
cv::HOGDescriptor?hog;?//?采用默認參數
//?2.?設置SVM分類器
hog.setSVMDetector(cv::HOGDescriptor::getDefaultPeopleDetector());???//?采用已經訓練好的行人檢測分類器
//?3.?在測試圖像上檢測行人區域
std::vector?regions;
for?(int?i?=?1;?i?<=?10;?i++)
{
sprintf(pathAndFileName?“../resource/%d.bmp“?i);//?用法
image?=?cv::imread(pathAndFileName);
if?(image.empty())
{
std::cout?<“read?image?failed“?< }
//hog.detectMultiScale(image?regions?0?cv::Size(8?8)?cv::Size(32?32)?1.05?1);
hog.detectMultiScale(image?regions?0);//?
//?顯示
for?(size_t?i?=?0;?i? {
cv::rectangle(image?regions[i]?cv::Scalar(0?0?255)?2);
}
cv::imshow(“output“?image);
sprintf(outputpathAndFileName?“../output/hog-output%d.bmp“?i);//?用法
cv::imwrite(outputpathAndFileName?image);
cv::waitKey(0);
}
cv::waitKey(0);
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????86528??2017-09-01?17:07??person-detect\Debug\test1.exe
?????文件?????489968??2017-09-01?17:07??person-detect\Debug\test1.ilk
?????文件????1806336??2017-09-01?17:07??person-detect\Debug\test1.pdb
?????文件?????131072??2017-09-01?20:19??person-detect\Debug\test2.exe
?????文件?????589928??2017-09-01?20:19??person-detect\Debug\test2.ilk
?????文件????2404352??2017-09-01?20:19??person-detect\Debug\test2.pdb
?????文件??????61440??2017-09-01?21:16??person-detect\Debug\test3-fastdpm.pdb
?????文件?????724518??2017-09-01?20:19??person-detect\output\dpm-cascade-output1.bmp
?????文件?????510054??2017-09-01?20:20??person-detect\output\dpm-cascade-output10.bmp
?????文件????1442166??2017-09-01?20:19??person-detect\output\dpm-cascade-output2.bmp
?????文件????1167990??2017-09-01?20:19??person-detect\output\dpm-cascade-output3.bmp
?????文件????1000494??2017-09-01?20:19??person-detect\output\dpm-cascade-output4.bmp
?????文件????1326582??2017-09-01?20:19??person-detect\output\dpm-cascade-output5.bmp
?????文件?????617174??2017-09-01?20:20??person-detect\output\dpm-cascade-output6.bmp
?????文件?????664734??2017-09-01?20:20??person-detect\output\dpm-cascade-output7.bmp
?????文件?????773386??2017-09-01?20:20??person-detect\output\dpm-cascade-output8.bmp
?????文件?????661626??2017-09-01?20:20??person-detect\output\dpm-cascade-output9.bmp
?????文件?????724518??2017-09-01?17:07??person-detect\output\hog-output1.bmp
?????文件?????510054??2017-09-01?17:07??person-detect\output\hog-output10.bmp
?????文件????1442166??2017-09-01?17:07??person-detect\output\hog-output2.bmp
?????文件????1167990??2017-09-01?17:07??person-detect\output\hog-output3.bmp
?????文件????1000494??2017-09-01?17:07??person-detect\output\hog-output4.bmp
?????文件????1326582??2017-09-01?17:07??person-detect\output\hog-output5.bmp
?????文件?????617174??2017-09-01?17:07??person-detect\output\hog-output6.bmp
?????文件?????664734??2017-09-01?17:07??person-detect\output\hog-output7.bmp
?????文件?????773386??2017-09-01?17:07??person-detect\output\hog-output8.bmp
?????文件?????661626??2017-09-01?17:07??person-detect\output\hog-output9.bmp
?????文件???50790400??2017-09-01?21:45??person-detect\person-detect.sdf
?????文件???????1415??2017-09-01?21:45??person-detect\person-detect.sln
????..A..H.?????27648??2017-09-01?21:45??person-detect\person-detect.v12.suo
............此處省略99個文件信息
評論
共有 條評論