|
|
@ -963,7 +963,28 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
double width = mat.size().width;
|
|
|
|
double width = mat.size().width;
|
|
|
|
// double ratio = std::min(height / 1024, width / 1920);
|
|
|
|
// double ratio = std::min(height / 1024, width / 1920);
|
|
|
|
double ratio = height / 1024.0;
|
|
|
|
double ratio = height / 1024.0;
|
|
|
|
|
|
|
|
int thickness = round(1.2 * ratio);
|
|
|
|
|
|
|
|
if (thickness < 1) thickness = 1;
|
|
|
|
|
|
|
|
else if (thickness > 4) thickness = 4;
|
|
|
|
|
|
|
|
cv::Scalar scalar(255, 255, 255); // white
|
|
|
|
|
|
|
|
int fontSize = (int)(24.0 * ratio);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string fontPath;
|
|
|
|
|
|
|
|
if (existsFile("/system/fonts/NotoSansCJK-Regular.ttc"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fontPath = "/system/fonts/NotoSansCJK-Regular.ttc";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (existsFile("/system/fonts/NotoSerifCJK-Regular.ttc"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fontPath = "/system/fonts/NotoSerifCJK-Regular.ttc";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fontPath = m_appPath+ "fonts/Noto.otf";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cv::Ptr<cv::ft::FreeType2> ft2;
|
|
|
|
|
|
|
|
ft2 = cv::ft::createFreeType2();
|
|
|
|
|
|
|
|
ft2->loadFontData(fontPath.c_str(), 0);
|
|
|
|
// cv::Rect rc(0, 0, mat.cols, mat.rows);
|
|
|
|
// cv::Rect rc(0, 0, mat.cols, mat.rows);
|
|
|
|
// cv::rectangle (mat, rc, cv::Scalar(255, 255, 255), cv::FILLED);
|
|
|
|
// cv::rectangle (mat, rc, cv::Scalar(255, 255, 255), cv::FILLED);
|
|
|
|
std::vector<IDevice::RECOG_OBJECT> objs;
|
|
|
|
std::vector<IDevice::RECOG_OBJECT> objs;
|
|
|
@ -1021,29 +1042,8 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int thickness = (int)(4.0 * ratio);
|
|
|
|
|
|
|
|
if (thickness < 2) thickness = 2;
|
|
|
|
|
|
|
|
else if (thickness > 4) thickness = 4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cv::Scalar scalar(255, 255, 255); // white
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int fontSize = (int)(24.0 * ratio);
|
|
|
|
|
|
|
|
std::string fontPath;
|
|
|
|
|
|
|
|
if (existsFile("/system/fonts/NotoSansCJK-Regular.ttc"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fontPath = "/system/fonts/NotoSansCJK-Regular.ttc";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (existsFile("/system/fonts/NotoSerifCJK-Regular.ttc"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fontPath = "/system/fonts/NotoSerifCJK-Regular.ttc";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fontPath = m_appPath+ "fonts/Noto.otf";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cv::Ptr<cv::ft::FreeType2> ft2;
|
|
|
|
|
|
|
|
ft2 = cv::ft::createFreeType2();
|
|
|
|
|
|
|
|
ft2->loadFontData(fontPath.c_str(), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
|
|
|
|
|
|
|