0

When I compile the project no errors, but when i run the project i have a problem with fontQt.

OpenCV Error: The function/feature is not implemented (The library is compiled without QT support) in fontQt, file /home/developer/opencv/modules/highgui/src/window.cpp, line 507 terminate called after throwing an instance of 'cv::Exception' what(): /home/developer/opencv/modules/highgui/src/window.cpp:507: error: (-213) The library is compiled without QT support in function fontQt

Aborted (core dumped)

#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;
}

this is my cmake file

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} )
Nafe Kzir
  • 15
  • 4
  • _"The library is compiled without QT support"_ seems quite clear. Have you compiled OpenCV with Qt support? Any reason you can't use standard fonts, so you don't need to recompile OpenCV? – Miki Oct 11 '17 at 20:46
  • How I understand , if I add Qt to cmake it's will be work. – Nafe Kzir Oct 13 '17 at 14:56
  • Hi @NafeKzir, how to add Qt to cmake? – leon May 09 '18 at 09:10

0 Answers0