繁体   English   中英

使用opencv和PlayStation Eye进行高速视频捕捉

[英]High speed video capture with opencv and PlayStation Eye

我正在开发一个需要低分辨率和大约110 fps的项目。 所以我买了30美元的PlayStation眼睛,在240分辨率下提供120 fps的320分辨率。

我安装了以前版本的macam(因为最新版本不起作用)并成功获得大约120 fps(但由于macam中的一些错误,我无法记录)。

在此输入图像描述

我写了一个简单的代码将每个帧保存为jpg文件:

 #include <stdio.h>
 #include "cv.h"
 #include "highgui.h"
 #include<iostream>
 using namespace std;

 int main(int argc, char** argv) {

     int i = 0;
     char *buf;
     IplImage *frame;
     CvCapture* capture = cvCreateCameraCapture(3);
     cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 320);
     cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 240);
     cvSetCaptureProperty( capture, CV_CAP_PROP_FPS, 110);

     while (true) {

         frame = cvQueryFrame(capture);
         asprintf(&buf, "%d.jpg", i++);
         cvShowImage("1", frame);
         cvSaveImage(buf, frame);
         cvWaitKey(10);
     }
     return 0;
 }

但它每秒只能节省30帧。 我的意思是它创建30个文件而不是每秒110个文件。 有什么问题 ?

更新:我使用以下命令编译上面的代码:

g++ main.cpp `pkg-config --cflags opencv` `pkg-config --libs opencv` -o exec -m32

cvWaitKey(10); 等待10ms。

帧速率为110Hz需要每9ms拍摄一次快照,此外还有用于保存帧的处理时间。

所以这是一个问题,除了CV_CAP_PROP_FPS没有按预期工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM