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:
make uninstall
for the current installation of OpenCVmake install
for the new XIMEA & Qt support enabled installationMy 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();
}
Finally, I was able to figure it out.
I don't know why (hopefully somebody will have an explanation for that behaviour) but Qt Creator does not always seems to use the newest version of OpenCV.
I found some bits of a previous installation on my computer which Qt Creator was using instead of the newer versioned library files.
After purging every OpenCV bit and recompiling it with Qt and XIMEA camera driver support (and other unimportant stuff) everything was working fine.
Hope that helps.