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} )