免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#include #include #include #include #include void cvShowManyImages(char* title, int nArgs, .) / img - Used for getting the arguments IplImage *img; / DispImage - the image in which input images are to be copied IplImage *DispImage; int size; int i; int m, n; int x, y; / w - Maximum number of images in a row / h - Maximum number of images in a column int w, h; / scale - How much we have to resize the image float scale; int max; / If the number of arguments is lesser than 0 or greater than 12 / return without displaying if(nArgs 12) printf(Number of arguments too large.n); return; / Determine the size of the image, / and the number of rows/cols / from number of arguments else if (nArgs = 1) w = h = 1; size = 300; else if (nArgs = 2) w = 2; h = 1; size = 300; else if (nArgs = 3 | nArgs = 4) w = 2; h = 2; size = 300; else if (nArgs = 5 | nArgs = 6) w = 3; h = 2; size = 200; else if (nArgs = 7 | nArgs = 8) w = 4; h = 2; size = 200; else w = 4; h = 3; size = 150; / Create a new 3 channel image DispImage = cvCreateImage( cvSize(100 + size*w, 60 + size*h), 8, 3 ); / Used to get the arguments passed va_list args; va_start(args, nArgs); / Loop for nArgs number of arguments for (i = 0, m = 20, n = 20; i width; y = img-height; / Find whether height or width is greater in order to resize the image max = (x y)? x: y; / Find the scaling factor to resize the image scale = (float) ( (float) max / size ); / Used to Align the images if( i % w = 0 & m!= 20) m = 20; n+= 20 + size; / Set the image ROI to display the current image cvSetImageROI(DispImage, cvRect(m, n, (int)( x/scale ), (int)( y/scale ); / Resize the input image and copy the it to the Single Big Image cvResize(img, DispImage); / Reset the ROI in order to display the next image cvResetImageROI(DispImage); / Create a new window, and show the Single Big Image /cvNamedWindow( title, 1 ); cvShowImage( title, DispImage); /*cvWaitKey(0);*/ /cvDestroyWindow(title); / End the number of arguments va_end(args); / Release the Image Memory cvReleaseImage(&DispImage);int main(int argc,char *argv) CvCapture *capture; int i=0; if (argc=2) capture=cvCreateFileCapture(argv1); else printf(No video file input!n); return -1; IplImage *frame; cvNamedWindow(video,1); cvResizeWindow(video,700,660); CvFont timeFont,timeFont1; cvInitFont(&timeFont,CV_FONT_HERSHEY_COMPLEX,0.5f,0.5f,0,1,8); cvInitFont(&timeFont1,CV_FONT_HERSHEY_COMPLEX,0.5f,0.5f,0,1,8); char time125; memset(time1,0,25*sizeof(char); while (1) frame=cvQueryFrame( capture ); if (!frame) break; IplImage *frame_not=cvCreateImage(cvGetSize(frame),frame-depth,frame-nChannels); cvNot(frame,frame_not); time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char *p=asctime(timeinfo); /p25n,24 for (i=0;idepth,1); IplImage *frame1=cvCreateImage(cvGetSize(frame),frame-depth,frame-nChannels); IplImage *frame_canny=cvCreateImage(cvGetSize(frame),frame-depth,1); IplImage *frame2=cvCreateImage(cvGetSize(frame),frame-depth,frame-nChannels); cvCvtColor(frame,frame_gray,CV_RGB2GRAY); cvCvtColor(frame_gray,frame1,CV_GRAY2BGR); cvCanny(frame_gray,frame_canny,20,75,3); cvCvtColor(frame_canny,frame2,CV_GRAY2BGR); cvPutText(frame,time1,cvPoint(0,15),&timeFont,CV_RGB(255,0,0); cvPutText(frame1,time1,cvPoint(0,15),&timeFont,CV_RGB(255,0,0); cvPutText(frame2,time1,cvPoint(0,15),&timeFont1,CV_RGB(255,0,0); cvPutText(frame_not,time1,cvPoint(0,15),&timeFont1,CV_RGB(255,0,0); cvShowManyImages(video,4,frame,frame_not,frame1,frame2); cvWaitKey(33); cvReleaseImage
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年法制宣传日普法知识竞赛题库及答案
- 可持续设计理念的应用标准
- 2025年农林对口单招题库及答案
- 电子厂安全生产培训试题及答案
- 2025年唐山中考物理试卷及答案
- 河北农业大学招聘考试真题2024
- 2024年中国华电科工集团有限公司所属基层企业系统内外招聘笔试真题
- 诗歌艺术手法综合考试题及答案
- 合成操作工的试题带答案
- 2025年中考配图高级题库及答案
- 陕西省西安铁一中2025届物理高一上期中统考试题含解析
- JGJ∕T194-2009钢管满堂支架预压技术规程
- 宠物犬鉴赏与疾病防治智慧树知到期末考试答案章节答案2024年石河子大学
- 《四川大学SCI期刊分级方案》
- 管理原理及管理方法
- 幼儿园社会教育专题-考核测试题三(第五、六章)-国开(ZJ)-参考资料
- 2024年英语专业四级真题2
- 护理学学生的职业生涯发展报告
- TORCH的检测及其临床意义
- 陕22N1 供暖工程标准图集
- 人教版四年级数学下册第六单元分层作业设计
评论
0/150
提交评论