视频文件为空,使用cvWriteToAVI - OpenCv [英] video file is empty using cvWriteToAVI - OpenCv
问题描述
嗨
我有一些代码可以使用cvWriteToAVI函数(来自OpenCV)在c ++中将图像流保存到视频文件中,我的操作系统是Ubuntu,它工作得很好,
但是因为一些问题我重新安装了ubuntu并安装了所有需要的东西(我想是这样):
OpenCV,codeBlocks,Buildessential,libavformat-dev和其他库
但是相同的代码没有现在工作,我的意思是其他部分没关系,除了cvWriteToAVI()函数
我的代码中的
我首先创建视频文件(也适用)
代码:
Hi
I had some code to save stream of images into a video file using cvWriteToAVI function (from OpenCV) in c++ and my OS was Ubuntu and it worked perfectly,
But because of some problems I reinstalled ubuntu and installed all needed things(I think so):
OpenCV , codeBlocks , Buildessential , libavformat-dev and other libs
but that same code doesn't work now, I mean other parts are okay except cvWriteToAVI() function
in my code I first create the video file(which works too)
code :
CvSize size = cvSize(640,480);
int codec = CV_FOURCC('M', 'J', 'P', 'G');
CvVideoWriter* writer = cvCreateVideoWriter("video",codec,30,size);
// Get an image (works okay)
IplImage* image = ardrone.getImage();
//shows the image here
cvShowImage("camera", image);
cvWriteToAVI(writer,image); // seems this line doesn't work!
任何帮助都会受到赞赏
any help would be appreciated
推荐答案
使用
cvWriteFrame(作家,图片);
而不是
cvWriteToAVI(作家,图片);
可能有效。
Use
cvWriteFrame(writer,image);
instead of
cvWriteToAVI(writer,image);
may works.
这篇关于视频文件为空,使用cvWriteToAVI - OpenCv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!