OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
12
返回列表 发新帖
楼主: xio99xio

求助~~如何把视频逐帧读取并保存这些帧图像?

[复制链接]
发表于 2015-11-5 10:33:25 | 显示全部楼层
楼主好,能不能把你这个代码分享给我用下呀,谢谢
回复 支持 反对

使用道具 举报

发表于 2015-11-5 22:27:24 | 显示全部楼层
zazelily 发表于 2015-11-5 10:33
楼主好,能不能把你这个代码分享给我用下呀,谢谢

//#include<stdio.h>
//#include<stdlib.h>
//#include"cv.h"
//#include"highgui.h"
//#include<time.h>
//int main()
//  {
//          cvNamedWindow("win1");
//    while(1)
//    {
//      time_t now;
//      struct tm  *timenow;
//      time(&now);
//          char outFileName[]="2011-01-01 24H00M00S.jpg";//修改
//          
//          IplImage *image=0;cvShowImage("win1",image);
//        timenow = localtime(&now);
//        printf("saving...\n");
//
//        *(outFileName+5)=timenow->tm_mon/10+'0';
//        *(outFileName+6)=timenow->tm_mon%10+'0';
//        *(outFileName+8)=timenow->tm_mday/10+'0';
//        *(outFileName+9)=timenow->tm_mday%10+'0';
//        *(outFileName+11)=timenow->tm_hour/10+'0';
//        *(outFileName+12)=timenow->tm_hour%10+'0';
//        *(outFileName+14)=timenow->tm_min/10+'0';
//        *(outFileName+15)=timenow->tm_min%10+'0';
//        *(outFileName+17)=(timenow->tm_sec)/10+'0';
//        *(outFileName+18)=(timenow->tm_sec)%10+'0';
//
//     CvCapture  *capture =cvCaptureFromCAM(0);
//        //CvCapture *capture=cvCaptureFromFile("http://192.168.1.1:8080/?action=stream?dummy=param.mjpg");
//    if (capture==NULL)
//        printf("camera is null\n");
//    else
//        printf("camera is not null");
//   
//     image = cvQueryFrame(capture);
//          cvShowImage("win1",image);
//     if (!image)
//     {
//       printf("Could not grab a frame\n\7");
//       exit(0);
//     }
//
//
//
//    if(!cvSaveImage(outFileName,image)) printf("Could not save: %s\n",outFileName);
//    char c = cvWaitKey(10);
//       if(c == 5)
//       {
//        break;
//           }  
//          // cvReleaseCapture(&capture);
//    }
//  return 0;
//  }
回复 支持 反对

使用道具 举报

发表于 2016-9-10 23:11:24 | 显示全部楼层
楼主你好,我也想同时保存三组图片,请问用的什么方法,求赐教
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-4-18 16:58 , Processed in 0.008025 second(s), 12 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表