Skip to content

Instantly share code, notes, and snippets.

@jayrambhia

jayrambhia/errors

Created Sep 19, 2012
Embed
What would you like to do?
compiling opencv_webcam.cpp
opencv_webcam.cpp: In function ‘int main()’:
opencv_webcam.cpp:8:9: error: ‘cap’ was not declared in this scope
opencv_webcam.cpp:11:9: error: ‘k’ was not declared in this scope
opencv_webcam.cpp:11:23: error: ‘waitkey’ was not declared in this scope
opencv_webcam.cpp:12:9: error: expected ‘;’ before ‘if’
Output file => opencv_webcam
compiling opencv_webcam.cpp
opencv_webcam.cpp: In function ‘int main()’:
opencv_webcam.cpp:8:9: error: ‘cap’ was not declared in this scope
opencv_webcam.cpp:11:9: error: ‘k’ was not declared in this scope
opencv_webcam.cpp:11:23: error: ‘waitkey’ was not declared in this scope
opencv_webcam.cpp:12:9: error: expected ‘;’ before ‘if’
Output file => opencv_webcam
#include<opencv2/highgui/highgui.hpp>
using namespace cv;
int main()
{
while(1)
{
cap = VideoCapture(0);
Mat img = cap.read();
imshow("image",img);
k = waitkey(10)
if k == 27:
break;
}
return 0;
}
#include<opencv2/highgui/highgui.hpp>
using namespace cv;
int main()
{
int k;
VideoCapture cap = VideoCapture(0);
while(1)
{
Mat img;
cap >> img;
imshow("image",img);
k = waitKey(10);
if (k == 27)
{
break;
}
}
return 0;
}
//This works perfectly well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment