PDA

View Full Version : Why My Qt Application Don't SHow?



dragon_hua
8th March 2011, 02:58
Hi,
I am a new one ,studying the Qt and OpenCV.I just put the OpenCV2.2 integration in Qt4.7.The steps likes this:Creating a QGui Application and in the .pro file add the INCLUDEPATH=INCLUDEPATH +=C:/OpenCV2.2/include
INCLUDEPATH +=C:/OpenCV2.2/include/opencv
LIBS +=C:/OpenCV2.2/bin/*.dll
I want to show the image using the OpenCV function and the codes likes:


void Widget::slot_showimage()
{
img=cvLoadImage("11.bmp");
cvNamedWindow("11.bmp",0);
cvShowImage("11.bmp",img);
cvWaitKey(0);
//QTimer::singleShot(100000,this,SLOT(close()));
cvDestroyWindow("11.bmp");
}

the Compile passed but it doesn't show the image window and the exited code likes this:
Starting E:\Qt_pratise\untitled4\debug\untitled4.exe...
E:\Qt_pratise\untitled4\debug\untitled4.exe exited with code -1073741515

I don't know why?:confused:

ChrisW67
8th March 2011, 05:37
You have your [code] tags the wrong way around.

You will need to set a breakpoint in the code and single step to find where it crashes and why. We can only guess with the information you have given us (especially because it is not Qt code).

Edit: I'd specifically check that the cvLoadImage() is returning a valid pointer, because the current working directory is probably not what you think it is and the file may not be found.