From 9d9c29aa7db2ff4bd56f3aa05680c18f6e1e7758 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Sun, 25 Feb 2024 09:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=9C=E8=89=B2=E6=A0=A1?= =?UTF-8?q?=E6=AD=A3=E5=8F=8A=E8=A3=81=E5=88=87=E7=AE=97=E6=B3=95BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imgproc/algs/ImageProcess_Public.cpp | 11 +++++++---- imgproc/algs/auto_crop.cpp | 8 +++++--- xmake.lua | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/imgproc/algs/ImageProcess_Public.cpp b/imgproc/algs/ImageProcess_Public.cpp index 9cd800e..9899aee 100644 --- a/imgproc/algs/ImageProcess_Public.cpp +++ b/imgproc/algs/ImageProcess_Public.cpp @@ -4,6 +4,7 @@ #include #include #include +#include static cv::Mat lutGrayMat; //灰色校正值 static cv::Mat lutColorMat; //彩色校正值 @@ -453,16 +454,19 @@ namespace hg void initLut(const std::string lutpath,bool iscolor) { - lutColorMat.release(); - lutGrayMat.release(); - if (!lutpath.empty() && (access(lutpath.c_str(), F_OK) == 0)) { printf("\n-----init lutpath =%s------------\n",lutpath.c_str()); if(iscolor) + { + lutColorMat.release(); lutColorMat = loadLUT(lutpath); //彩色校正值 + } else + { + lutGrayMat.release(); lutGrayMat = loadLUT(lutpath); //灰色校正值 + } } } @@ -474,7 +478,6 @@ namespace hg { return; } - cv::Mat image_temp(src.rows, src.cols * src.channels() / lutMat.channels(), CV_8UC(lutMat.channels()), src.data); for (size_t i = 0; i < image_temp.cols; i++) diff --git a/imgproc/algs/auto_crop.cpp b/imgproc/algs/auto_crop.cpp index c79200c..2bca010 100644 --- a/imgproc/algs/auto_crop.cpp +++ b/imgproc/algs/auto_crop.cpp @@ -92,7 +92,7 @@ void auto_crop::init(void) }; OPTION_FUNC(paper) { - crop_ = //strcmp((char*)val, WORDS_PAPER_ORIGIN_SIZE) == 0 || + crop_ = strcmp((char*)val, WORDS_PAPER_ORIGIN_SIZE) == 0 || strcmp((char*)val, WORDS_PAPER_MAX_SIZE_CROP) == 0; if(crop_) memset(&fixed_paper_, 0, sizeof(fixed_paper_)); @@ -125,9 +125,10 @@ int auto_crop::work(PROCIMGINFO& in, PROCIMGINFO& out) dWidth = fixed_paper_.cx * 1.0f / MM_PER_INCH * in.info.resolution_x + .5f, dHeight = fixed_paper_.cy * 1.0f / MM_PER_INCH * in.info.resolution_x + .5f; - cv::Mat thre; + cv::Mat thre, resize; - hg::threshold_Mat(in.img, thre, threshold_); + cv::resize(in.img, resize, cv::Size(), FX_FY, FX_FY, cv::INTER_NEAREST); + hg::threshold_Mat(resize, thre, threshold_); if (noise_ > 0) cv::morphologyEx(thre, thre, cv::MORPH_OPEN, getStructuringElement(cv::MORPH_RECT, cv::Size(cv::max(static_cast(noise_ * FX_FY), 1), 1)), @@ -157,6 +158,7 @@ int auto_crop::work(PROCIMGINFO& in, PROCIMGINFO& out) } cv::RotatedRect rect = hg::getBoundingRect(maxContour); + if (rect.size.width < 1 || rect.size.height < 1) { out.img = in.img; diff --git a/xmake.lua b/xmake.lua index 6a42ade..0789026 100644 --- a/xmake.lua +++ b/xmake.lua @@ -60,8 +60,8 @@ add_packagedirs("sdk") add_defines("BUILD_AS_DEVICE") add_defines("VER_MAIN=2") add_defines("VER_FAMILY=200") -add_defines("VER_DATE=20240223") -add_defines("VER_BUILD=12") +add_defines("VER_DATE=20240225") +add_defines("VER_BUILD=9") target("conf") set_kind("phony")