I’m trying to use the Freetype2 module of openCV to use custom fonts, but I’m failing to make it work.
I have tried using the pre-compiled libraries and building openCV with the git-bash method of OpenCV: Installation in Windows (latest current release, 4.5.2) with no success.
I want to use it in Visual Studio: I have tried adding “PreviousPath\OpenCV_4.5.2\opencv_contrib\modules\freetype\include” to the Additional Include Directories in the project properties; while this makes Visual Studio and Intellisense “accept” freetype.hpp, when I try to build the solution it tells me there are unresolved externals (which obviously means I have failed to properly add the library, but I don’t know where my mistake is).
I’m unsure if I’m not configuring my project correctly or if I’m failing to build the source correctly. I have tried looking at tutorials on how to build OpenCV with Freetype, but the documentation is scarce and I haven’t been able to follow the methods proposed. I have seen mentioned that I need the freetype and hardbuzz libraries, but I don’t know how to add them so that CMake recognises them when building the extra modules of OpenCV.
Has anyone been able to use it and could you please tell me how to do it?
you’ll notice that I “installed” both. I’m sure you can install them anywhere, or not at all. I don’t know if cmake has some intelligence about finding stuff in those default directories or not.
Many thanks for the help. I think I’m starting to understand a bit better now, but I’m still stuck at the very beginning (note that I’m very new to using CMake and compiling from source).
However, I’m at a complete lost on what to do from here. I don’t know how to specify for harfbuzz where to find the include folders and lib files (I assume this is somewhere in the CMakeLists file but don’t know where) and probably will have the same problem once I move onto compiling freetype again and opencv. Namely, I’m getting te following error:
" HB_HAVE_FREETYPE was set, but we failed to find it. Maybe add a
CMAKE_PREFIX_PATH= to your Freetype2 install prefix" I just don’t know how to do what it says.
I’m actually using cmake-gui, but I must be making some mistake along the way. Sadly, I can’t wait for a few months. In any case, thank you for the help you have given me.