我用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) 展开
#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) 展开
1个回答
展开全部
调整一下初始化语句的位置。
#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;
}
#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;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询