[英]OpenCV image is not showing
I am working on the following code:我正在处理以下代码:
Main.cpp主程序
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat im = imread("C:/Users/Public/Pictures/Sample Pictures/Koala.jpg");
if (im.empty())
{
cout << "Cannot load image!" << endl;
return -1;
}
imshow("Image", im);
waitKey(0);
return 0;
}
I am trying to test the OpenCV with QT, by simply opening an image.我正在尝试通过简单地打开图像来使用 QT 测试 OpenCV。 This is my very first QT application.这是我的第一个 QT 应用程序。 However, the program runs, but there is no image display!但是,程序运行了,却没有图像显示! The same code runs in VS 2010 and display the image correctly.相同的代码在 VS 2010 中运行并正确显示图像。 Following is the only output I get from QT.以下是我从 QT 得到的唯一输出。
Following is my QT Project configuration.以下是我的 QT 项目配置。
Tester.pro测试版
#-------------------------------------------------
#
# Project created by QtCreator 2013-04-25T23:36:30
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = Tester
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:\opencv\build\include\
LIBS += -LC:\opencv\build\x86\mingw\lib\
-lopencv_core240 \
-lopencv_highgui240 \
-lopencv_imgproc240 \
-lopencv_features2d240 \
-lopencv_calib3d240
Here are the version I am using:这是我正在使用的版本:
How can I make this opencv task work correctly?我怎样才能使这个 opencv 任务正常工作?
I just checked the .exe file it built.我刚刚检查了它构建的 .exe 文件。 It gives the following error when I double click on it当我双击它时出现以下错误
That error means that the Operating System was unable to find the .DLL when your application was launched.该错误意味着操作系统在您的应用程序启动时无法找到.DLL 。
There are 2 ways to fix that:有两种方法可以解决这个问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.