資源簡介
詳情請閱讀我的博客,有相關的介紹說明,代碼可用
代碼片段和文件信息
#include?
#include?
#include?
#include?
int?main(int?argcchar?**argv)
{
cvNamedWindow(“test“CV_WINDOW_AUTOSIZE);//創建窗口
CvCapture?*capture?=cvCreateFileCapture(“test.avi“);//讀入視頻信息,capture為AVI文件的開頭
IplImage?*frame=?NULL; //原始圖像
IplImage*?gray?=?NULL; //灰度圖像
IplImage*?gray_mean?=?NULL;
IplImage*?gray_mean_temp?=?NULL;
CvScalar?s0s1RED;
int?hmax=0hmin=0wmax=0wmin=0;
RED.val[0]=0;
RED.val[1]=0;
RED.val[2]=255;
frame=cvQueryframe(capture);//取出一幀的圖像
gray=cvCreateImage(cvGetSize(frame)?frame->depth?1);
gray_mean=cvCreateImage(cvGetSize(gray)gray->depth1);
gray_mean_temp=cvCreateImage(cvGetSize(gray)gray->depth1);
while(1)
{
frame=cvQueryframe(capture);
if(!frame)
break;
hmax=0;
wmax=0;
hmin=frame->height;
wmin=frame->width;
cvCvtColor(frame?gray?CV_BGR2GRAY);
cvThreshold(gray?gray_mean70?255?CV_THRESH_BINARY);
cvCopy(gray_meangray);
cvSmooth(graygray_meanCV_BLUR3300);
cvSobel(gray_meangray113);
cvErode(graygray_mean?NULL1);
cvDilate(gray_meangray?NULL1);
cvCopy(graygray_mean);
s0=cvGet2D(gray_mean1010);
s1=cvGet2D(gray_mean_temp1010);
cvShowImage(“the“gray);
printf(“------------------------------\n“);
for(int?i=50;iheight-50;i++)
for(int?j=100;jwidth-50;j++)
{
s0=cvGet2D(gray_meanij);
s1=cvGet2D(gray_mean_tempij);
if(fabs(s0.val[0]-s1.val[0])!=0)
{
if(i hmin=i;
if(i>hmax)
hmax=i;
if(j wmin=j;
if(j>wmax)
wmax=j;
}
else;
}
printf(“(%d,%d)(%d,%d)\n“hminhmaxwminwmax);
for(int?i=hmin;i<=hmax;i++)
{
cvSet2D(frameiwminRED);
cvSet2D(frameiwmaxRED);
}
for(int?j=wmin;j<=wmax;j++)
{
cvSet2D(framehminjRED);
cvSet2D(framehmaxjRED);
}
cvShowImage(“test“frame);//將圖像顯示
cvShowImage(“test1“gray);//將圖像顯示
cvShowImage(“test2“gray_mean);//將圖像顯示
cvCopy(gray_meangray_mean_temp);
cvShowImage(“test3“gray_mean_temp);
char?c=cvWaitKey(50);
}
while(1);
cvReleaseCapture(&capture);
//cvDestroyWindow(“test“);
//cvDestroyWindow(“test1“);
//cvDestroyWindow(“test2“);
//cvDestroyWindow(“test3“);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3913??2014-10-27?21:56??avi\avi\avi.vcxproj
?????文件????????942??2014-10-27?21:56??avi\avi\avi.vcxproj.filters
?????文件????????143??2014-10-27?21:44??avi\avi\avi.vcxproj.user
?????文件????????406??2014-10-27?21:56??avi\avi\Debug\avi.exe.em
?????文件????????472??2014-10-27?21:56??avi\avi\Debug\avi.exe.em
?????文件????????381??2015-04-23?10:13??avi\avi\Debug\avi.exe.intermediate.manifest
?????文件?????????46??2015-04-23?10:13??avi\avi\Debug\avi.lastbuildstate
?????文件???????3018??2015-04-23?10:13??avi\avi\Debug\avi.log
?????文件????????707??2014-10-27?21:56??avi\avi\Debug\avi.vcxprojResolveAssemblyReference.cache
?????文件??????????0??2014-10-27?21:56??avi\avi\Debug\avi.write.1.tlog
?????文件????????196??2014-10-27?21:56??avi\avi\Debug\avi_manifest.rc
?????文件????????578??2015-04-23?10:13??avi\avi\Debug\cl.command.1.tlog
?????文件??????16820??2015-04-23?10:13??avi\avi\Debug\CL.read.1.tlog
?????文件????????228??2015-04-23?10:13??avi\avi\Debug\CL.write.1.tlog
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????????2??2015-04-23?10:13??avi\avi\Debug\li
?????文件???????2740??2015-04-23?10:13??avi\avi\Debug\li
?????文件???????6560??2015-04-23?10:13??avi\avi\Debug\li
?????文件????????518??2015-04-23?10:13??avi\avi\Debug\li
?????文件??????92499??2015-04-23?10:13??avi\avi\Debug\main.obj
?????文件????????324??2015-04-23?10:13??avi\avi\Debug\mt.command.1.tlog
?????文件????????230??2015-04-23?10:13??avi\avi\Debug\mt.read.1.tlog
............此處省略26個文件信息
- 上一篇:一體化產品需求文檔樣例
- 下一篇:Synopsys_installer
評論
共有 條評論