91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

在利用Adaboost算法識別物體之前,需要用ObjectMarker標定正樣本進行正樣本數據的采集。早先別人上傳的ObjectMarker不可用,我作了些修改上傳,希望對大家有幫助。運行前把正樣本圖片放在rawdata文件夾下,運行時按空格標定正樣本區域,按回車繼續下一張圖。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?

//?for?filelisting
#include?
#include?
//?for?fileoutput
#include?
#include?
#include?

using?namespace?std;

IplImage*?image=0;
IplImage*?image2=0;
int?start_roi=0;
int?roi_x0=0;
int?roi_y0=0;
int?roi_x1=0;
int?roi_y1=0;
int?numOfRec=0;
char*?window_name=“add?save?and?load?next?exit“;

string?IntToString(int?num)
{
ostringstream?myStream;?//creates?an?ostringstream?object
myStream?< /*
*?outputs?the?number?into?the?string?stream?and?then?flushes
*?the?buffer?(makes?sure?the?output?is?put?into?the?stream)
*/
return(myStream.str());?//returns?the?string?form?of?the?stringstream?object
};

?void?on_mouse(int?event?int?x?int?y?int?flag?void*?param)
{
????if(event==CV_EVENT_LBUTTONDOWN)
????{
start_roi=1;
roi_x0=x;
roi_y0=y;
????}
????if(event==CV_EVENT_MOUSEMOVE?&&?flag==CV_EVENT_FLAG_LBUTTON)
????{
roi_x1=x;
roi_y1=y;

//redraw?ROI?selection
image2=cvCloneImage(image);
cvRectangle(image2cvPoint(roi_x0roi_y0)cvPoint(roi_x1roi_y1)CV_RGB(2550255)1);
cvShowImage(window_nameimage2);
cvReleaseImage(&image2);
????}
????if(event==CV_EVENT_LBUTTONUP)
????{
start_roi=0;
????}
}

int?main(int?argc?char**?argv)
{

struct?_finddata_t?bmp_file;
????long?hFile;
int?iKey=0;

// get?*.bmp?files?in?directory
if((hFile=_findfirst(“rawdata/*.jpg“&bmp_file))==-1L)
printf(“no?*.bmp?files?in?directory?‘rawdata‘\n“);
else
{

// init?highgui
cvAddSearchPath(“rawdata“);
cvNamedWindow(window_name1);
cvSetMouseCallback(window_nameon_mouse);

// init?output?of?rectangles?to?the?info?file
ofstream?output(“info.txt“);

string?strPrefix;
string?strPostfix;

// open?every?*.bmp?file
do
{
printf(“?%-12s\n“bmp_file.name);

numOfRec=0;
strPostfix=““;
strPrefix=“rawdata/“;
strPrefix+=bmp_file.name;

image?=?cvLoadImage(strPrefix.c_str()?1);

// work?on?current?image
do
{
cvShowImage(window_nameimage);

//?used?cvWaitKey?returns:
// =13 save?added?rectangles?and?show?next?image
// =27 exit?program
// =32 add?rectangle?to?current?image
//??any?other?key?clears?rectangle?drawing?only
iKey=cvWaitKey(0);
switch(iKey)
{
case?27:
cvReleaseImage(&image);
cvDestroyWindow(window_name);
return?0;
case?32:
numOfRec++;
//?currently?two?draw?directions?possible:
// from?top?left?to?bottom?right?or?vice?versa
if(roi_x0 {
printf(“???%d.?rect?x=%d\ty=%d\twidth=%d\theight=%d\n“numOfRecroi_x0roi_y0roi_x1-roi_x0roi_y1-roi_y0);
//?append?rectangle?coord?to?previous?line?content
strPostfix+=“?“+IntToString(roi_x0)+“?“+IntToString(roi_y0)+“?“+IntToString(roi_x1-ro

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-02-22?15:37??objectMarker\
?????目錄???????????0??2017-02-22?15:37??objectMarker\objectMarker\
?????文件?????1187898??2006-09-12?18:23??objectMarker\objectMarker\CV.dll
?????文件????????4097??2017-02-22?11:52??objectMarker\objectMarker\objectMarker.vcxproj
?????文件?????????953??2017-02-22?11:52??objectMarker\objectMarker\objectMarker.vcxproj.filters
?????文件??????512070??2006-09-12?18:25??objectMarker\objectMarker\cvaux.dll
?????文件??????512000??2006-09-12?18:23??objectMarker\objectMarker\highgui.dll
?????文件????????1906??2017-02-22?13:35??objectMarker\objectMarker\info.txt
?????文件????????3912??2017-02-22?13:29??objectMarker\objectMarker\objectmarker.cpp
?????目錄???????????0??2017-02-22?15:37??objectMarker\objectMarker\rawdata\
?????文件??????143402??2017-02-21?22:07??objectMarker\objectMarker\rawdata\1_1297_113.430269_34.526398.jpg
?????文件????????4608??2006-11-02?19:49??objectMarker\objectMarker\rawdata\Thumbs.db
?????文件?????????982??2017-02-22?11:49??objectMarker\objectMarker.sln
?????文件???????20992??2017-02-22?15:20??objectMarker\objectMarker.v12.suo

評論

共有 條評論