C++ OpenCV Freetype2 getTextSize始终返回1高度

C++ OpenCV Freetype2 getTextSize始终返回1高度,c++,linux,opencv,raspberry-pi,C++,Linux,Opencv,Raspberry Pi,我正在尝试使用OpenCV在NanoPi NEO上生成图像。 目前正在使用Armbian bionic和OpenCV 4.3.0(使用freetype2模块的源代码构建)。 问题是Freetype2::getTextSize()方法总是返回1作为文本高度。但宽度似乎计算得很好。在台式电脑上,同样的代码也能正常工作 #include <iostream> #include <opencv2/core.hpp> #include <opencv2/freetype.hp

我正在尝试使用OpenCV在NanoPi NEO上生成图像。 目前正在使用Armbian bionic和OpenCV 4.3.0(使用freetype2模块的源代码构建)。 问题是Freetype2::getTextSize()方法总是返回1作为文本高度。但宽度似乎计算得很好。在台式电脑上,同样的代码也能正常工作

#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/freetype.hpp>

int main() {
    cv::Ptr<cv::freetype::FreeType2> ft2;
    int baseline = 0;

    ft2 = cv::freetype::createFreeType2();
    ft2->setSplitNumber( 8 );
    ft2->loadFontData("../gobold.ttf", 0);

    cv::Size textSize = ft2->getTextSize("asdfg", 20, -1, &baseline);
    std::cout << "Height = " << textSize.height << " Width = " << textSize.width << std::endl;
    return 0;
}
#包括
#包括
#包括
int main(){
cv::Ptr-ft2;
int基线=0;
ft2=cv::freetype::createFreeType2();
ft2->setSplitNumber(8);
ft2->loadFontData(“../gobold.ttf”,0);
cv::Size textSize=ft2->getTextSize(“asdfg”、20、-1和基线);

std::cout您的桌面上运行的是什么操作系统?另外,还有一个与此相关的公开问题:但似乎不会在该提交修复错误后得到修复。希望它能很快被集成>您的桌面上运行的是什么操作系统?另外,还有一个与此相关的公开问题:但似乎不会在该提交修复错误后得到修复ug.希望它能很快集成>