Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

simple image display code not working in qt creator

Hello everyone, I'm running a a simple image display program with opencv in QtCreator but whenever i run the code it opens a console(qtcreator_process_stub.exe),says press<return> to close window and then nothing happens Please i need help Below is my code:

MAIN.CPP

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main() {
Mat image= imread("imgage.jpg");
namedWindow("My Image");
imshow("My Image", image);
waitKey(5000);
return 1;
}

.PRO file:

QT += core
TARGET = opencv
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:/opencv/build_with_Qt/debug/include
LIBS += -LC:/opencv/build_with_Qt/debug/lib \
-lopencv_core244d\
-lopencv_highgui244d\
-lopencv_imgproc244d\
-lopencv_features2d244d\
-lopencv_calib3d244d