OpenCV-highgui.hpp中的错误 [英] OpenCV - Error in highgui.hpp
本文介绍了OpenCV-highgui.hpp中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用网络摄像头检测车道.我可以在一开始对其进行编译并对其进行测试,但是在更换了我以前使用过的机器之后. 它不再工作了.给我一些错误.
i am trying to detect lane using a web cam. i could compile it in the beginning and test it but after changing the machine which i used to work on. it isnt working any more. Gives me some error back.
以下是代码
int run() {
bool pause = false`;`
VideoCapture cam(0);
//VideoCapture cam("clip.mp4");
if(!cam.isOpened())
{
cout<<"\n Error Opening Device"<<endl;
return 0;
}
width=cam.get(CV_CAP_PROP_FRAME_WIDTH);
height=cam.get(CV_CAP_PROP_FRAME_HEIGHT);
init();
while(1)
{
cam >> frame;
frameclone=frame.clone();
drawElement(frame);
imshow("Live Feed",frame);
cvtColor(frameclone,bw,CV_RGB2GRAY);
blur( bw, bw, Size(5,5) );
Canny( bw, canny,0,75,3);
imshow("canny",canny);
regionofinterest();
cvtColor(canny,canny,CV_GRAY2BGR);
imshow("debug",canny);
//houghT();
imshow("ROI",frame);
switch(waitKey(18))
{
case 113:
cout<<"Exiting"<<endl;
return -1;
break;
case 033:
cout<<"Exiting"<<endl;
return -1;
break;
case 112:
pause=!pause;
cout<<"Code Paused"<<endl;
if(pause==true)
{
switch(waitKey())
case 112:
pause=!pause;
cout<<"Code Resumed"<<endl;
break;
}
}
}
}
我也包含了
#include "opencv2/opencv.hpp"
#include "opencv2/photo/photo.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "iostream"
#include "stdio.h"
但是它仍然给我以下错误:-
But still it gives me the following error:-
/home/ashik/Desktop/Project/detectlane/detectlane.cpp: In member function ‘void Detect::init()’:
/home/ashik/Desktop/Project/detectlane/detectlane.cpp:35:23: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
namedWindow("debug",CV_WINDOW_AUTOSIZE);
^
/home/ashik/Desktop/Project/detectlane/detectlane.cpp:36:23: error: ‘CV_WINDOW_NORMAL’ was not declared in this scope
namedWindow("canny",CV_WINDOW_NORMAL);
^
/home/ashik/Desktop/Project/detectlane/detectlane.cpp: In member function ‘int Detect::run()’:
/home/ashik/Desktop/Project/detectlane/detectlane.cpp:89:17: error:
‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
width=cam.get(CV_CAP_PROP_FRAME_WIDTH);
^
/home/ashik/Desktop/Project/detectlane/detectlane.cpp:90:18: error: ‘CV_CAP_PROP_FRAME_HEIGHT’ was not declared in this scope
height=cam.get(CV_CAP_PROP_FRAME_HEIGHT);
^
/home/ashik/Desktop/Project/detectlane/detectlane.cpp:98:27: error: ‘CV_RGB2GRAY’ was not declared in this scope
cvtColor(frameclone,bw,CV_RGB2GRAY);
^
/home/ashik/Desktop/Project/detectlane/detectlane.cpp:103:25: error: ‘CV_GRAY2BGR’ was not declared in this scope
cvtColor(canny,canny,CV_GRAY2BGR);
^
make[2]: *** [CMakeFiles/detectlane.dir/detectlane.cpp.o] Error 1
make[1]: *** [CMakeFiles/detectlane.dir/all] Error 2
make: *** [all] Error 2
我使用了cmake和opencv 3.0.0 alpha
i used cmake and opencv 3.0.0 alpha
推荐答案
我遇到了同样的问题.尝试包括
I encountered the same problem. Try including
#include <highgui.h>
这篇关于OpenCV-highgui.hpp中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文