我用1.0版本为什么编译时会出现 'CvCapture' : illegal use of this type as an expression

我的程序是书上的例子2播放AVI视频的,VC也配置了,但是编译的时候却出现了很多问题,求指教#include"highgui.h"#include"stdio.h"#in... 我的程序是书上的例子2播放AVI视频的,VC也配置了,但是编译的时候却出现了很多问题,求指教

#include "highgui.h"
#include "stdio.h"
#include "cxcore.h"
#include "cv.h"

int main(int argc, char** argv)
{
cvNamedWindow("handsome", CV_WINDOW_AUTOSIZE );
CvCapture* capture = cvCreateFileCapture( argv[1] );
IplImage* frame;
while(1)
{
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage("handsome", frame );
char c = cvWaitKey(33);
if( c== 27 ) break;
}
cvReleaseCapture( &capture );
cvDestoryWindow( "handsome" );
return 0;
}

编译时
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(9) : error C2275: 'CvCapture' : illegal use of this type as an expression
d:\opencv1.0\otherlibs\highgui\highgui.h(216) : see declaration of 'CvCapture'
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(9) : error C2065: 'capture' : undeclared identifier
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(10) : error C2275: 'IplImage' : illegal use of this type as an expression
d:\opencv1.0\cxcore\include\cxtypes.h(393) : see declaration of 'IplImage'
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(10) : error C2065: 'frame' : undeclared identifier
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(13) : warning C4047: 'function' : 'struct CvCapture *' differs in levels of indirection from 'int '
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(13) : warning C4024: 'cvQueryFrame' : different types for formal and actual parameter 1
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(13) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct _IplImage *'
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(15) : warning C4022: 'cvShowImage' : pointer mismatch for actual parameter 2
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(16) : error C2143: syntax error : missing ';' before 'type'
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(17) : error C2065: 'c' : undeclared identifier
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(19) : warning C4047: 'function' : 'struct CvCapture ** ' differs in levels of indirection from 'int *'
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(19) : warning C4024: 'cvReleaseCapture' : different types for formal and actual parameter 1
D:\vc6.0\MSDev98\MyProjects\opencv2_2\opencv2_2.c(20) : warning C4013: 'cvDestoryWindow' undefined; assuming extern returning int
执行 cl.exe 时出错.

opencv2_2.obj - 1 error(s), 0 warning(s)
展开
 我来答
Excellent928
2013-04-09
知道答主
回答量:9
采纳率:0%
帮助的人:3.9万
展开全部
调整一下初始化语句的位置。
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
int main(int argc, char** argv) {
char c;
IplImage* frame;
CvCapture* capture=cvCreateFileCapture("E:\\SupPlateCaoZuoLuxiang.avi");
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
while(1) {
frame=cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Example2",frame);
c= cvWaitKey(33);
if(c==27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Example2");
return 0;
}
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式