OpenCV学习笔记(5)在单个窗口中显示多个视频子窗口

参考OpenCV中文论坛的一个帖子(http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=7996&start=0)实现了在一个窗口显示多个视频子窗口,能够读入单个的视频或摄像头数据,然后在一个窗口中分别显示原始帧图像、反色图像、灰度图像以及Canny边缘检测图像。并在每个子窗口左上角显示系统时间,函数cvShowManyImages是改写的。

2

代码如下:

#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

#include <stdio.h>
#include <stdarg.h>
#include <time.h>

// 隐藏 console 窗口
#pragma comment( linker, "/subsystem:/"windows/" /entry:/"mainCRTStartup/"" )

// 单窗口显示多幅图像的函数
void cvShowMultiImages(char* title, int nArgs, ...) 
{

   // img - Used for getting the arguments 
   IplImage* img;

   // DispImage - the image in which all the input images are to be copied
   IplImage* DispImage;

   int size;    // size - the size of the images in the window
   int ind;        // ind - the index of the image shown in the window
   int x, y;    // x,y - the coordinate of top left coner of input images
   int w, h;    // w,h - the width and height of the image

   // r - Maximum number of images in a column 
   // c - Maximum number of images in a row 
   int r, c;

   // scale - How much we have to resize the image
   float scale;
   // max - Max value of the width and height of the image
   int max;
   // space - the spacing between images
   int space;

   // If the number of arguments is lesser than 0 or greater than 12
   // return without displaying 
   if(nArgs <= 0) {
      printf("Number of arguments too small..../n");
      return;
   }
   else if(nArgs >
  • 3
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 23
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 23
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值