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")