OpenCV 3,使用fontQt运行项目时出错?

时间:2017-10-11 19:31:11

标签: opencv opencv3.1

当我编译项目时没有错误,但是当我运行项目时我遇到了fontQt的问题。

OpenCV错误:函数/功能没有实现(在没有QT支持的情况下编译库)在fontQt,文件/home/developer/opencv/modules/highgui/src/window.cpp,第507行 在抛出' cv :: Exception'的实例后终止调用   what():/ home /developer/opencv/modules/highgui/src/window.cpp:507:错误:( - 213)在函数fontQt中没有QT支持编译库

中止(核心倾销)

#include <iostream>
#include <string>

#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

void pushButtonCallBack(int, void *font);

Mat originImg, tmpImg;
string win_img = "win_img";
char msg[50];

int main(int argc, char** argv)
{
std::cout << "OpenCV add text to img..." << std::endl;

originImg = imread(argv[1],IMREAD_UNCHANGED);

if(originImg.empty())
{
    cout << "url is not true" << endl;
    return -1;
}

string AddText = "AddText";
string text= "Text";

cv::QtFont font = fontQt("Arail", 20, Scalar(255,0,0,0), QT_FONT_BLACK, QT_STYLE_NORMAL);

createButton(AddText, pushButtonCallBack, &font, QT_PUSH_BUTTON );

imshow(win_img,originImg);
waitKey(0);
return 0;

}

void pushButtonCallBack(int, void *font)
{
addText(originImg, "Click", Point(50,50), *(QtFont *)font);
imshow(win_img, originImg);
return;
}

这是我的cmake文件

cmake_minimum_required(VERSION 3.8)
project(lesson_3_3)

set(CMAKE_CXX_STANDARD 11)

find_package( OpenCV REQUIRED )

set(SOURCE_FILES main.cpp)
add_executable(lesson_3_3 ${SOURCE_FILES})
target_link_libraries( lesson_3_3 ${OpenCV_LIBS} )

0 个答案:

没有答案