I figured out that Qt creator is using Qt for the OpenCV functions by default.
When even running a test code (see below) which opens and shows a camera stream. Here, it is not possible to open the camera (I am using a XIMEA xiQ). With a normal webcam it is working.
In Eclipse both is working.
Brief summary of steps I have done so far:
- OpenCV is compiled with XIMEA camera support
- I recompiled OpenCV with Qt support
make uninstall
for the current installation of OpenCVmake install
for the new XIMEA & Qt support enabled installation
My test code:
#include "mainwindow.h"
#include <QApplication>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char *argv[]){
QApplication a(argc, argv);
MainWindow w;
w.show();
VideoCapture cap(0);
if (!cap.isOpened()){
cout << "Cannot open the video cam" << endl;
return -1;
}
while (1){
Mat frame;
bool bSuccess = cap.read(frame);
if (!bSuccess){
cout << "Cannot read a frame from video stream" << endl;
break;
}
imshow("MyVideo", frame);
if (waitKey(30) == 27){
cout << "esc key is pressed by user" << endl;
break;
}
}
return a.exec();
}