downsize images l.t. 500 pixels

This commit is contained in:
leca 2025-06-14 19:57:08 +03:00
parent 373c51f0b8
commit 37a77d7228
4 changed files with 9 additions and 3 deletions

View File

@ -222,7 +222,7 @@ include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(checks-parser PUBLIC ${Boost_LIBRARIES})
if (BUILD_OFD_LOCAL_QR_SCAN OR BUILD_OFD_BINARYEYE_SCAN)
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs opencv_objdetect videoio)
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs opencv_objdetect videoio highgui)
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS})
target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS})
include_directories( ${OpenCV_INCLUDE_DIRS} )

View File

@ -199,6 +199,12 @@ std::string EmailParser::handle_image(std::string &content) {
}
if (image.empty()) return "";
if (image.rows >= 500 || image.cols >= 500) {
cv::Mat copy(image);
cv::resize(copy, image, cv::Size(150, 150), cv::INTER_LINEAR);
cv::imwrite(get_path_relative_to_home(".local/share/checks_parser/tmp.jpg"), image);
}
cv::QRCodeDetector qrDecoder = cv::QRCodeDetector();
std::string decoded_qr = qrDecoder.detectAndDecode(image);
return find_check_parameters(decoded_qr);

View File

@ -671,7 +671,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="55"/>
<location filename="../main.cpp" line="59"/>
<source>Using locale: </source>
<translation>Using locale: </translation>
</message>

View File

@ -647,7 +647,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="55"/>
<location filename="../main.cpp" line="59"/>
<source>Using locale: </source>
<translation>Использую локаль: </translation>
</message>