开发者

Interference problem between Qt GUI and OpenCV2.2 imageshow

I'm developing a stereovision application using OpenCV, Qt creator and MinGW under windows 7. In previous version OpenCV 2.0 , I had a Qt main widget with a plenty of SpinBoxes to control OpenCV stereo matching process, and three windows creat开发者_如何转开发ed by OpenCV routines to show left, right views and image depth reconstruction, and all thing were going fine. Now I moved to OpenCV 2.2, which btw seems a lot better, but I noticed that the windows created by OpenCV in fact override the Qt main widget, so that is impossible to interact with it. The obvious solution would be to NOT use OpenCV GUI at all and to translate CvMat images to IplImages and then to QImage for shoqwing it inside Qt widget. But this is not so easy...I tried using the method IplImageToQImage from but for some reason it crashes. SO before digging in that hard matter I would like to know if there is some easy way to avoid OpenCV to keep focus on its own windows, just like it happened in version 2.0...thanks!


I had a similiar problem with OpenCV 2.2, not sure if it's exactly the one you have: HighGUI with Qt support creates it's own QApplication, and this won't work if you created your own. I posted a bug report which includes a patch. I've been using this patch since then with no problems (Windows, VS2008, Qt 4.7). See https://code.ros.org/trac/opencv/ticket/919


I'm not sure how relevant this is to your problem and I'm pretty new to openCV but I pass the Mat data directly to QImage so I don't have any crashing issues with openCV. (I use 2.2 on QT4.7 in OSX)

QImage imgToDisp ( (uchar*) Mat.data, Mat.cols, Mat.rows, Mat.step, QImage::Format_XXX );

Hope that works for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜