标识符未在具有win32控制台的visual studio中定义

时间:2013-03-26 14:27:23

标签: visual-studio-2010 console

我使用win32控制台和opencv在visual studio中编写代码并且编译得很好,但是当我使用相同的GUI代码时会导致很多错误。我想在一个图片框中显示一个IplImage但是在编译它时总是显示一条消息“标识符未定义”如何解决这个问题 谢谢

private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) {
IplImage* img = 0;
int height,width,step,channels;
uchar *data;

cvNamedWindow("Fenetre_test", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Fenetre_test", 100, 100);

CvCapture* capture = cvCaptureFromCAM(0);
while(cvWaitKey(600)!=' '){
img=cvQueryFrame(capture);

height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar *)img->imageData;
//cout << "Processing a " << width << "x" << height << " image with " << channels << " channels" << endl;

cvShowImage("Fenetre_test", img );
cvWaitKey(10);
int result=cvSaveImage("srcc.jpg",img);

错误

 "CvCapture" identificatuer not declare
"img" identificatuer not declare
"height" identificatuer not declare
"width" identificatuer not declare
"step" identificatuer not declare
"channels" identificatuer not declare
"data" identificatuer not declare

however I declared its "IplImage* img = 0;
int height,width,step,channels;
uchar *data;"

0 个答案:

没有答案