Thank you for sharing the fact that your program doesn't work. It would help if you shared even the smallest amount of information about how it fails. At the moment all we know is that program fails. We can surmise that your "unexpected exit" problem is your code using an uninitialised or invalid pointer or an uninitialised data structure. Beyond that we could guess all day.
From the knowledge that many programs use both Qt and OpenCV I can be almost certain this is not a collision between QImage and OpenCV. This, for example, works just fine.
#include <QtGui>
#include <QDebug>
#include <opencv/cv.h>
#include <opencv/highgui.h>
int main(int argc, char *argv[])
{
label.
setPixmap( QPixmap::fromImage(image
) );
label.show();
// load an image
IplImage* img = cvLoadImage("test.jpg");
if(!img)
qFatal("Could not load image file\n");
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO | CV_GUI_NORMAL);
cvMoveWindow("mainWin", 100, 100);
cvShowImage("mainWin", img );
int result = app.exec();
cvDestroyWindow("mainWin");
cvReleaseImage(&img );
return result;
}
#include <QtGui>
#include <QDebug>
#include <opencv/cv.h>
#include <opencv/highgui.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QImage image("test.jpg");
QLabel label;
label.setPixmap( QPixmap::fromImage(image) );
label.show();
// load an image
IplImage* img = cvLoadImage("test.jpg");
if(!img)
qFatal("Could not load image file\n");
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO | CV_GUI_NORMAL);
cvMoveWindow("mainWin", 100, 100);
cvShowImage("mainWin", img );
int result = app.exec();
cvDestroyWindow("mainWin");
cvReleaseImage(&img );
return result;
}
To copy to clipboard, switch view to plain text mode
Bookmarks