I'm trying to set up OpenCV in Qt Creator and I have some problems. I added the OpenCV path in the Qt Creator .pro file
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann
And I want to read and show image in this code
void MainWindow::on_pushButton_clicked()
{
cv::Mat matInput = cv::imread("LP.jpg");
if( matInput.empty())
{
std::cout<<"Can't load image "<<std::endl;
}
cv::namedWindow("Show");
cv::imshow("Show", matInput);
cv::waitKey();
}
When I run my project it shows the following message:
Starting /home/vasan/Qt/build-OpenCVWithQt-Desktop-Debug/OpenCVWithQt...
The program has unexpectedly finished.
/home/vasan/Qt/build-OpenCVWithQt-Desktop-Debug/OpenCVWithQt exited with code 0
cv::Mat matInput = cv::imread("LP.jpg");, right ?