Opencv 视频保存 出错 unhandled exception
Opencv视频保存编译成功但是出现如下的错误Unhandledexceptionat0x5adda400(highgui200d.dll)inassignment2-3...
Opencv 视频保存
编译成功
但是
出现如下的错误
Unhandled exception at 0x5adda400 (highgui200d.dll) in assignment2-3.exe: 0xC0000005: Access violation reading location 0x719b3856.
// assignment2-3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
//#include "iostream.h"
/*IplImage* doPyrDown(
IplImage* in,
int filter = IPL_GAUSSIAN_5x5)
{
// Best to make sure input image is divisible by two.
//
assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(
cvSize( in->width/2, in->height/2 ),
in->depth,
in->nChannels
);
cvPyrDown( in, out );
return( out );
};*/
int main( int argc, char** argv)
{
cvNamedWindow( "assignment2-3", CV_WINDOW_AUTOSIZE );
CvCapture* capture=cvCaptureFromCAM(-1);
CvVideoWriter* video=NULL;
IplImage *frame = cvQueryFrame(capture);
double fps = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
CvVideoWriter* writer = cvCreateVideoWriter(
"d:\\w.avi",
-1,fps,
cvSize(frame->width,frame->height)
);
while(1)
{
frame=cvQueryFrame(capture);
if(!frame) break;
cvWriteFrame(writer,frame);
if(cvWaitKey(2)>0) break;
}
cvReleaseVideoWriter(&writer);
//cvReleaseImage(&logpolar_frame);
cvReleaseCapture(&capture);
return(0);
}
我又试过网上其它运行成功的程序
都会出现不同的错误
例如
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
int main( int argc, char** argv )
{
CvCapture* capture = 0;
IplImage* frame = 0;
//capture = cvCaptureFromCAM( 0 );
capture = cvCaptureFromAVI("d:\\tree.avi");//播放视频 就换成这句
//int fps=25; //捕捉帧率
double fps = cvGetCaptureProperty(capture,CV_CAP_PROP_FPS); //视频帧率
CvVideoWriter* writer = 0; //保存就加上这句
int isColol=1;
int frameW=640;
int frameH=480;
writer=cvCreateVideoWriter("d:\\out.avi",CV_FOURCC('F','L','V','1'),fps,cvSize(frameW,frameH),isColol);
cvNamedWindow( "摄像头", 1 );
//for(int i=0;i<50;i++) //2秒
for(;;) //一直读
{
frame = cvQueryFrame( capture );
cvWriteFrame(writer,frame );
cvShowImage( "摄像头", frame ); //显示一帧图像
cvWaitKey(1000 / fps);//视频速度
}
出现错误是
Unhandled exception at 0x5374530a (opencv_ffmpeg200.dll) in test.exe: 0xC0000005: Access violation reading location 0x00000008.
我的配置是 win7+vc2008 expression +opencv2.0
之前装过 vs2010+opencv2.1 没有删除
不知道是不是系统的问题 还是程序设置的问题
谢谢各位大侠帮我弄清楚吧 下周二交作业
我已经调程序调了一个晚上 从下午7点到现在凌晨五点
就冲我这么用功 也请大侠们帮帮我 快绝望了 先谢谢大家了 展开
编译成功
但是
出现如下的错误
Unhandled exception at 0x5adda400 (highgui200d.dll) in assignment2-3.exe: 0xC0000005: Access violation reading location 0x719b3856.
// assignment2-3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
//#include "iostream.h"
/*IplImage* doPyrDown(
IplImage* in,
int filter = IPL_GAUSSIAN_5x5)
{
// Best to make sure input image is divisible by two.
//
assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(
cvSize( in->width/2, in->height/2 ),
in->depth,
in->nChannels
);
cvPyrDown( in, out );
return( out );
};*/
int main( int argc, char** argv)
{
cvNamedWindow( "assignment2-3", CV_WINDOW_AUTOSIZE );
CvCapture* capture=cvCaptureFromCAM(-1);
CvVideoWriter* video=NULL;
IplImage *frame = cvQueryFrame(capture);
double fps = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
CvVideoWriter* writer = cvCreateVideoWriter(
"d:\\w.avi",
-1,fps,
cvSize(frame->width,frame->height)
);
while(1)
{
frame=cvQueryFrame(capture);
if(!frame) break;
cvWriteFrame(writer,frame);
if(cvWaitKey(2)>0) break;
}
cvReleaseVideoWriter(&writer);
//cvReleaseImage(&logpolar_frame);
cvReleaseCapture(&capture);
return(0);
}
我又试过网上其它运行成功的程序
都会出现不同的错误
例如
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
int main( int argc, char** argv )
{
CvCapture* capture = 0;
IplImage* frame = 0;
//capture = cvCaptureFromCAM( 0 );
capture = cvCaptureFromAVI("d:\\tree.avi");//播放视频 就换成这句
//int fps=25; //捕捉帧率
double fps = cvGetCaptureProperty(capture,CV_CAP_PROP_FPS); //视频帧率
CvVideoWriter* writer = 0; //保存就加上这句
int isColol=1;
int frameW=640;
int frameH=480;
writer=cvCreateVideoWriter("d:\\out.avi",CV_FOURCC('F','L','V','1'),fps,cvSize(frameW,frameH),isColol);
cvNamedWindow( "摄像头", 1 );
//for(int i=0;i<50;i++) //2秒
for(;;) //一直读
{
frame = cvQueryFrame( capture );
cvWriteFrame(writer,frame );
cvShowImage( "摄像头", frame ); //显示一帧图像
cvWaitKey(1000 / fps);//视频速度
}
出现错误是
Unhandled exception at 0x5374530a (opencv_ffmpeg200.dll) in test.exe: 0xC0000005: Access violation reading location 0x00000008.
我的配置是 win7+vc2008 expression +opencv2.0
之前装过 vs2010+opencv2.1 没有删除
不知道是不是系统的问题 还是程序设置的问题
谢谢各位大侠帮我弄清楚吧 下周二交作业
我已经调程序调了一个晚上 从下午7点到现在凌晨五点
就冲我这么用功 也请大侠们帮帮我 快绝望了 先谢谢大家了 展开
2个回答
展开全部
可以试一下openCV1.0,我一般用这个,高版本可能会出问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询