From 80da6b8c1c0c0f6515ed30a12991e098a4b431b6 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Wed, 14 Jun 2023 09:27:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0402=20=E5=9B=BE=E5=83=8F?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/image_process.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/hgdriver/hgdev/image_process.cpp b/hgdriver/hgdev/image_process.cpp index 89756de..a2f193f 100644 --- a/hgdriver/hgdev/image_process.cpp +++ b/hgdriver/hgdev/image_process.cpp @@ -486,7 +486,7 @@ namespace hg_imgproc buffer_.reset(new std::vector()); int i=0; - vectorTemp_mat; + vectorTemp_mat; for (auto& buf : buffs) { i++; @@ -526,11 +526,11 @@ namespace hg_imgproc { Temp_mat.push_back(mat); //cv::imwrite(std::to_string(i)+"_decode.jpg",mat); - } - else if(pid == 0x300 || pid == 0x400|| pid == 0x402 || pid == 0x302) + } + else if (pid == 0x300 || pid == 0x400 || pid == 0x402 || pid == 0x302) { - Temp_mat.push_back(mat(cv::Rect(0, 0, mat.cols / 2, mat.rows))); - Temp_mat.push_back(mat(cv::Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows))); + Temp_mat.push_back(mat(cv::Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows))); //front + Temp_mat.push_back(mat(cv::Rect(0, 0, mat.cols / 2, mat.rows))); //back } buffer_.reset(new std::vector()); @@ -543,8 +543,12 @@ namespace hg_imgproc } buffs.clear(); + if (Temp_mat.empty()) + { + return SCANNER_ERR_NO_DATA; + } - if (pid_ == 0x200 || pid_ == 0x300 || pid_ == 0x400 || pid_ == 0x100) + if (pid_ == 0x100 || pid_ == 0x200 || pid_ == 0x300 || pid_ == 0x400 || pid == 0x402 || pid == 0x302) { //////除穿孔算法移至解压图像之后 double left = img_conf_.fillholeratio_left / 100.0; @@ -552,17 +556,10 @@ namespace hg_imgproc double top = img_conf_.fillholeratio_up / 100.0; double low = img_conf_.fillholeratio_down / 100.0; if (left > 0 || right > 0 || top > 0 || low > 0) - fillhole1(Temp_mat, top, low, right, left); + fillhole1(Temp_mat, top, low, left, right); VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Remove hole is '%s',Hole image buffer size is:%d\n", !Temp_mat.empty() ? "enable" : "close", Temp_mat.size()); - } - if (Temp_mat.empty()) - { - return SCANNER_ERR_NO_DATA; - } - //mats_.resize(Temp_mat.size()); - if (pid_ ==0x100 ||pid_ == 0x200 || pid_ == 0x300 || pid_ == 0x400) - { + if (img_conf_.is_duplex) { mats_.push_back(img_conf_.is_switchfrontback ? Temp_mat[1] : Temp_mat[0]); @@ -575,8 +572,7 @@ namespace hg_imgproc { mats_ = Temp_mat; } - - + Temp_mat.clear(); VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size());