1 | initial version |
You are mixing up C and C++ code interfaces. Could you try this piece of code?
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int, char**)
{
VideoCapture capturo(0);
Mat img1, img2;
int input;
namedWindow("Image 1",CV_WINDOW_AUTOSIZE);
namedWindow("Image 2",CV_WINDOW_AUTOSIZE);
for(;;){
int input = 0xFF & waitKey(33);
if(input == 27) break;
if (input == 49){
capturo >> img1;
imshow("Image 1",img1.clone());
}
if (input == 50){
capturo >> img2;
imshow("Image 2",img2.clone());
}
}
return 0;
}
2 | No.2 Revision |
You are mixing up C and C++ code interfaces. Could you try this piece of code?code? Also many systems require you to and the output of the waitKey command with 0xFF.
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int, char**)
{
VideoCapture capturo(0);
Mat img1, img2;
int input;
namedWindow("Image 1",CV_WINDOW_AUTOSIZE);
namedWindow("Image 2",CV_WINDOW_AUTOSIZE);
for(;;){
int input = 0xFF & waitKey(33);
if(input == 27) break;
if (input == 49){
capturo >> img1;
imshow("Image 1",img1.clone());
}
if (input == 50){
capturo >> img2;
imshow("Image 2",img2.clone());
}
}
return 0;
}