createButton OpenCV 新 Qt 功能

createButton OpenCV new Qt functionality

当我尝试编译它时,它给了我一个

Unhandled exception at 0x75B0C42D in Example7.exe: Microsoft C++ exception: cv::Exception at memory location 0x0016F9EC.

我不知道还能尝试什么。我尝试了很多不同的方法,环顾四周,但似乎没有找到适合我的方法。

我是 运行 OpenCV 2.4.11 Visual Studio 2013 全部在 x84 库中 windows 7 x64.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int state;

void callbackButton2(int state, void* userdata)
  {
     cout << "Could not open or find the image" << std::endl;
  }

int main()
 {
   Mat image;
    image =        imread("C:/Users/anjamaco/Documents/OPENCV/CODE/1/Example1/Capture2.PNG",1);   // Read the fi

if (!image.data)                              // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl;
    return -1;
}

namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
namedWindow("Control Panel", CV_WINDOW_AUTOSIZE | CV_GUI_NORMAL);

createButton("Dummy button", callbackButton2, NULL, CV_PUSH_BUTTON, 1);


imshow("Display window", image);                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;
 }

有人可以给我一个例子,说明如何实现在控制台上显示文本的按钮吗?

此功能仅在您使用 QT 支持 构建 OpenCV 时有效。默认情况下,OpenCV 不附带此功能。

在装有 MSVC 2013 的 Windows 8 机器上,我可以看到以下消息随崩溃一起打印到控制台:

OpenCV Error: The function/feature is not implemented (The library is compiled without QT support) in cv::createButton, file C:\builds\master_PackSlave-win32-vc12-shared\opencv\modules\highgui\src\window.cpp, line 478