OpenCV新增Qt功能

createButton OpenCV new Qt functionality

本文关键字:功能 Qt 新增 OpenCV      更新时间:2023-10-16

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

在Example7.exe中0x75B0C42D的未处理异常: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错误:功能/特性未实现(库在没有QT支持的情况下编译)在cv::createButton,文件C:buildsmaster_PackSlave-win32-vc12-shared OpenCV moduleshighguisrcwindow.cpp,第478行