opencv 如何显示多幅图像

       主函数是用于读取摄像头,并在视频上写时间字幕:

     

   CvCapture* capture;   

  
      capture = cvCaptureFromCAM(0);
 

   IplImage* frame;

   cvNamedWindow("video",1);
   cvResizeWindow("video",750,750);

   CvFont timeFont,timeFont1;
   cvInitFont(&timeFont,  CV_FONT_HERSHEY_COMPLEX, 1.0f,1.0f,0,1,8);
   cvInitFont(&timeFont1, CV_FONT_HERSHEY_COMPLEX, 1.0f,1.0f,0,1,8);

   // Initialize new applied memory of 'time1'
 char timestr[25];
   memset(timestr, 0, 25 * sizeof(char));

   while (1)
   {
      frame = cvQueryFrame( capture );
      if (!frame) break;

      // Get the systme local time info
      time_t rawtime;
      struct tm* timeinfo;
      //time( &rawtime ); 

      rawtime = time( NULL );
      timeinfo = localtime( &rawtime );
      char* p = asctime( timeinfo );

      // the 25th character of array 'p' is '/n'
      // but it can not be display correctly in the image
      // so we just read out the first 24 character of 'p'
 for (int i = 0; i < 24; i++)
      {
         timestr[i] = *p;
         p++;
      }
      p = NULL;

      // Bitwise inversion of every element of the current frame
      IplImage* frame_not = cvCreateImage(cvGetS
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值