【发布时间】:2011-03-21 01:45:29
【问题描述】:
每当我试图读出 avi 文件并在 windows xp 中使用 Opencv 2.1 和 VS 2008 转换为灰度时
我不明白为什么我在无法获得帮助的同时出现以下运行时错误
错误 1
[NULL @ 0x37da10]无效和 低效的 vfw-avi 压缩 B 帧 检测到 fps=23 帧 (w, h) = (640, 272)输出#0,avi,到'test.avi': 流#0.0:视频:mpeg4、yuv420p、 640x272, q=2-31, 11141 kb/s, 90k tbn, 23 .98 待定 [mpeg4 @ 0x37f920] 正在删除 来自帧率 [mpeg4 @ 0x37da10]无效且低效 检测到 vfw-avi 压缩 B 帧 编译器未对齐堆栈 变量。 Libavcodec 已经 编译错误,可能非常慢或 碰撞。这不是一个错误 libavcodec,但在编译器中。你 可以尝试使用 gcc >= 4.2 重新编译。 不要向 FFmpeg 报告崩溃 开发商。 [mpeg4 @ 0x37da10]无效 和低效的 vfw-avi 包装 B 检测到的帧
如果我尝试其他一些 avi 文件,那么我会收到以下运行时错误
错误 2
fps=15 帧 (w, h) = (176, 184) 输出#0,avi,到“demo.avi”: 流 #0.0:视频:mpeg4、yuv420p、176x184、q=2-31、2072 kb/s、 90k tbn,15 tbc 编译器未对齐 堆栈变量。 Libavcodec 已经 编译错误,可能非常慢或 碰撞。这不是一个错误 libavcodec,但在编译器中。你 可以尝试使用 gcc >= 4.2 重新编译。 不要向 FFmpeg 报告崩溃 开发人员。
我真的不知道这里发生了什么是我学习 OpenCV 的代码,
// VideoCon.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
#include <stdio.h>
int main( int argc, char* argv[] ) {
cvNamedWindow( "Example2_10", CV_WINDOW_AUTOSIZE );
cvNamedWindow( "Log_Polar", CV_WINDOW_AUTOSIZE );
CvCapture* capture = cvCreateFileCapture( "Rambo.avi" );
if (!capture){
return -1;
}
IplImage* bgr_frame;
double fps = cvGetCaptureProperty (
capture,
CV_CAP_PROP_FPS
);
printf("fps=%d\n",(int)fps);
CvSize size = cvSize(
(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH),
(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT)
);
printf("frame (w, h) = (%d, %d)\n",size.width,size.height);
#ifndef NOWRITE
CvVideoWriter* writer = cvCreateVideoWriter(
// On linux Will only work if you've installed ffmpeg development files correctly,
"test.avi",
// otherwise segmentation fault. Windows probably better.
CV_FOURCC('D','X','5','0'),
fps,
size
);
#endif
IplImage* logpolar_frame = cvCreateImage(
size,
IPL_DEPTH_8U,
3
);
IplImage* gray_frame = cvCreateImage(
size,
IPL_DEPTH_8U,
1
);
while( (bgr_frame=cvQueryFrame(capture)) != NULL ) {
cvShowImage( "Example2_10", bgr_frame );
cvConvertImage( //We never make use of this gray image
bgr_frame,
gray_frame,
CV_RGB2GRAY
);
cvLogPolar( bgr_frame, logpolar_frame,
//This is just a fun conversion the mimic's the human visual system
cvPoint2D32f(bgr_frame->width/2,
bgr_frame->height/2),
40,
CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS );
cvShowImage( "Log_Polar", logpolar_frame );
//Sigh, on linux, depending on your ffmpeg, this often won't work ...
#ifndef NOWRITE
cvWriteToAVI( writer, logpolar_frame );
#endif
char c = cvWaitKey(10);
if( c == 27 ) break;
}
#ifndef NOWRITE
cvReleaseVideoWriter( &writer );
#endif
cvReleaseImage( &gray_frame );
cvReleaseImage( &logpolar_frame );
cvReleaseCapture( &capture );
}
【问题讨论】:
标签: c visual-studio-2008 video opencv