資源簡介
里面含有關鍵幀提取的代碼,還有人臉檢測等代碼,是vs+opencv實現的
代碼片段和文件信息
#include
#include
#include
#include
#include
using?namespace?std;
int?main()
{
cvNamedWindow(“result“1);
IplImage*?pcrtframe?=?NULL?*frame_copy?=?NULL;
//CvMat*?pcrtframeMat?=?NULL;
CvCapture*?pcrtCapture?=?NULL;
pcrtCapture?=?cvCaptureFromFile(“E:\\22.avi“);?//當前讀取的視頻
//pcrtframe?=?cvQueryframe(?pcrtCapture?);
int?outCompressCodec?=?(int)cvGetCaptureProperty(pcrtCapture?CV_CAP_PROP_FOURCC);
int?fps?=?(int)cvGetCaptureProperty(pcrtCaptureCV_CAP_PROP_FPS);
CvVideoWriter?*writer?=?0;
int?isColor?=?1;
//int?fps?????=?25;??//?or?30
int?frameW??=?432;?//?744?for?firewire?cameras
int?frameH??=?240;?//?480?for?firewire?cameras
writer=cvCreateVideoWriter(“out1.avi“CV_FOURCC(‘X‘‘V‘‘I‘‘D‘)fpscvSize(frameWframeH)isColor);?//outCompressCodec
CvFont?font;????//在圖片上顯示字符
cvInitFont(&font?CV_FONT_HERSHEY_SIMPLEX?1.0?1.0?0?2?8);?
????CvPoint?panda1;?
panda1.x=100;
panda1.y=44;
CvPoint?panda2;?
panda2.x=197;
panda2.y=109;
long?cnt?=?0;?//變量cnt用于記錄幀數
//for(int?i=0;i=i+10;)
while(pcrtframe?=?cvQueryframe(?pcrtCapture?))
{
cnt++;
if(?!frame_copy?)?//?創建圖像副本
frame_copy?=?cvCreateImage(?cvSize(pcrtframe->widthpcrtframe->height)
????????????????????????????????????????????IPL_DEPTH_8U?pcrtframe->nChannels?);
if(?pcrtframe->origin?==?IPL_ORIGIN_TL?)
cvCopy(?pcrtframe?frame_copy?0?);
else
cvFlip(?pcrtframe?frame_copy?0?);?
cvRectangle(?frame_copy?panda1?panda2?CV_RGB(25000)
??????????????????2?8?0?);
cvPutText(frame_copy?“Panda“?cvPoint(panda2.x+3?panda1.y+2)?&font?CV_RGB(25500));
cvPutText(frame_copy?“Walk“?cvPoint(panda2.x+3?panda1.y+25)?&font?CV_RGB(25500));
cvWaitKey(20);
cout< if((cnt%2==0)&&cnt<=200)
{
panda1.x+=1;
panda2.x+=1;
}
else?if(cnt>200)
{
panda1.x+=1;
panda1.y+=2;
panda2.x+=1;
panda2.y+=1;
}
cvWriteframe(writer?frame_copy);
cvShowImage(?“result“?frame_copy?);
cvWaitKey(10);
}
//cout<<“there?are?“<ames?in?this?video“<
cvReleaseVideoWriter(&writer);
cvDestroyWindow(“result“);
cvReleaseImage(&pcrtframe);
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-12-25?21:47??TEST\
?????文件??????106049??2013-11-01?08:51??TEST\1.jpg
?????目錄???????????0??2014-12-25?21:47??TEST\Debug\
?????文件???????85504??2014-12-25?21:47??TEST\Debug\TEST.exe
?????文件??????426948??2014-12-25?21:47??TEST\Debug\TEST.ilk
?????文件?????1510400??2014-12-25?21:47??TEST\Debug\TEST.pdb
?????文件???????25088??2013-11-10?17:33??TEST\SkinDectDLL.dll
?????目錄???????????0??2014-12-25?21:38??TEST\TEST\
?????文件??????106049??2013-11-01?08:51??TEST\TEST\1.jpg
?????文件??????110114??2013-11-01?08:51??TEST\TEST\2.jpg
?????目錄???????????0??2014-12-25?21:47??TEST\TEST\Debug\
?????文件???????32798??2014-12-25?21:44??TEST\TEST\Debug\CL.read.1.tlog
?????文件?????????434??2014-12-25?21:44??TEST\TEST\Debug\CL.write.1.tlog
?????文件????????1609??2013-11-13?22:26??TEST\TEST\Debug\TEST.Build.CppClean.log
?????文件?????????406??2013-11-13?22:26??TEST\TEST\Debug\TEST.exe.em
?????文件?????????472??2013-11-13?22:26??TEST\TEST\Debug\TEST.exe.em
?????文件?????????381??2013-11-14?15:51??TEST\TEST\Debug\TEST.exe.intermediate.manifest
?????文件??????????67??2014-12-25?21:47??TEST\TEST\Debug\TEST.lastbuildstate
?????文件????????1500??2014-12-25?21:47??TEST\TEST\Debug\TEST.log
?????文件?????????198??2013-11-13?22:26??TEST\TEST\Debug\TEST_manifest.rc
?????文件??????161968??2013-11-10?22:29??TEST\TEST\Debug\TestDLL.obj
?????文件????????1018??2014-12-25?21:44??TEST\TEST\Debug\cl.command.1.tlog
?????文件??????305584??2014-12-25?21:44??TEST\TEST\Debug\histogram.obj
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
?????文件???????????2??2014-12-25?21:47??TEST\TEST\Debug\li
............此處省略42個文件信息
- 上一篇:搜狗輸入法rpm數據包
- 下一篇:腦機接口終稿.pptx
評論
共有 條評論