From bb930a73803057f1bf0fef0b85c7802f699ba702 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 25 Apr 2024 17:37:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E4=BD=93=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=92=8C=E8=BD=AE=E5=BB=93=E7=BA=BF=E7=9A=84=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index ab25e480..169a1017 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1074,11 +1074,11 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat) double width = mat.size().width; // double ratio = std::min(height / 1024, width / 1920); double ratio = height / 1024.0; - int thickness = round(1.2 * ratio); + int thickness = round(1.4 * ratio); if (thickness < 1) thickness = 1; - else if (thickness > 4) thickness = 4; + else if (thickness > 5) thickness = 5; cv::Scalar scalar(255, 255, 255); // white - int fontSize = (int)(24.0 * ratio); + int fontSize = (int)(28.0 * ratio); cv::Point pt; std::string fontPath; @@ -1230,6 +1230,8 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat) } #endif + + textSize = ft2->getTextSize(it->text, fontSize, thickness, &baseline); XYLOG(XYLOG_SEVERITY_DEBUG, "%s font Size=%d height: %d baseline=%d", it->text.c_str(), fontSize, textSize.height, baseline);