資源簡介
hog特征+svm分類器行人檢測訓練的負樣本處理程序,千萬注意路徑問題
代碼片段和文件信息
#include?
#include?
#include??//srand()和rand()函數
#include??//time()函數
#include?
#include?
#include?
#include?
#include?
using?namespace?std;
using?namespace?cv;
int?CropImageCount?=?0;?//裁剪出來的負樣本圖片個數
int?main()
{
Mat?src;
string?ImgName;
char?saveName[256];//裁剪出來的負樣本圖片文件名
ifstream?fin(“INRIANegativeImageList.txt“);//打開原始負樣本圖片文件列表
//ifstream?fin(“subset.txt“);
//一行一行讀取文件列表
while(getline(finImgName))
{
cout<<“處理:“< ImgName?=?“E:\\運動目標檢測\\INRIAPerson\\Train\\neg\\“?+?ImgName;
src?=?imread(ImgName1);//讀取圖片
//src?=cvLoadImage(imagename1);
//cout<<“寬:“<
//圖片大小應該能能至少包含一個64*128的窗口
if(src.cols?>=?64?&&?src.rows?>=?128)
{
srand(time(NULL));//設置隨機數種子
//從每張圖片中隨機裁剪10個64*128大小的不包含人的負樣本
for(int?i=0;?i<10;?i++)
{
int?x?=?(?rand()?%?(src.cols-64)?);?//左上角x坐標
int?y?=?(?rand()?%?(src.rows-128)?);?//左上角y坐標
//cout< Mat?imgROI?=?src(Rect(xy64128));?
sprintf(saveName“E:\\運動目標檢測\\INRIAPerson\\negphoto\\noperson%06d.jpg“++CropImageCount);//生成裁剪出的負樣本圖片的文件名
imwrite(saveName?imgROI);//保存文件
}
}
}
system(“pause“);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-11-24?17:24??CropNegativeSampleFromImage\
?????目錄???????????0??2014-11-24?11:17??CropNegativeSampleFromImage\CropNegativeSampleFromImage\
?????文件?????????948??2013-11-06?20:28??CropNegativeSampleFromImage\CropNegativeSampleFromImage.sln
?????文件???????13312??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage.suo
?????文件????????1535??2014-11-24?16:36??CropNegativeSampleFromImage\CropNegativeSampleFromImage\CropNegativeSampleFromImage.cpp
?????文件????????5019??2014-11-24?11:06??CropNegativeSampleFromImage\CropNegativeSampleFromImage\CropNegativeSampleFromImage.vcxproj
?????文件?????????978??2013-11-06?20:40??CropNegativeSampleFromImage\CropNegativeSampleFromImage\CropNegativeSampleFromImage.vcxproj.filters
?????文件?????????143??2013-11-06?20:28??CropNegativeSampleFromImage\CropNegativeSampleFromImage\CropNegativeSampleFromImage.vcxproj.user
?????目錄???????????0??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\
?????文件?????????842??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\cl.command.1.tlog
?????文件???????19230??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CL.read.1.tlog
?????文件?????????578??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CL.write.1.tlog
?????文件????????2939??2014-11-24?10:34??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.Build.CppClean.log
?????文件?????????406??2014-11-24?10:34??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.exe.em
?????文件?????????472??2014-11-24?10:34??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.exe.em
?????文件?????????381??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.exe.intermediate.manifest
?????文件??????????77??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.lastbuildstate
?????文件????????3646??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.log
?????文件??????292046??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.obj
?????文件?????????707??2014-11-24?17:23??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.vcxprojResolveAssemblyReference.cache
?????文件???????????0??2014-11-24?10:34??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage.write.1.tlog
?????文件?????????244??2014-11-24?10:34??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\CropNegativeSampleFromImage_manifest.rc
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
?????文件???????????2??2014-11-24?17:24??CropNegativeSampleFromImage\CropNegativeSampleFromImage\Debug\li
............此處省略50個文件信息
評論
共有 條評論