I am working on Win7 x64 with the OpenCV and Qt and VS 2010 libraries.
I would like to open my camera using OpenCV, and then show the captured frames using Qt, for example using QLabel, after converting from Mat to QImage.
I want to do this because to use the imshow ("camera", image) and waitKey () functions slow down the camera's streaming.
This is my code:
int main () {
QApplication a(argc, argv);
QLabel myLabel;
VideoCapture cap(0);
//namedWindow(c"camera", 1);
for (;;) {
cap >> image;
//conversion from Mat to QImage
Mat dest;
cvtColor(image, dest,CV_BGR2RGB);
QImage image1= QImage((uchar*) dest.data, dest.cols, dest.rows, dest.step, QImage::Format_RGB888);
//show Qimage using QLabel
myLabel.setPixmap(QPixmap::fromImage(image1));
myLabel.show();
//imshow("camera",image);
//if (waitKey(30)>= 0) break;
}
return a.exec();
}
The webcam opens correctly and works, but I see a white window, not captured frames, as you can see in this image

If I uncomment: namedWindow (..), imshow(..), if(waitKey(..)it works (I see two windows with the same images), but I show captured frames from OpenCV, and I want to avoid this.
: - ? , Mat Qimage ??..
Qt?
!