From fedd3116d98e925a8b0f30362e5b9ef286cb21fb Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Mon, 26 Sep 2022 18:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/image_process.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hgdriver/hgdev/image_process.cpp b/hgdriver/hgdev/image_process.cpp index 1d809e9..7dc889b 100644 --- a/hgdriver/hgdev/image_process.cpp +++ b/hgdriver/hgdev/image_process.cpp @@ -325,11 +325,11 @@ namespace hg_imgproc int split(int multioutputtype,bool is_msplit,bool is_multiout_red,int colortype,bool is_duplex,int split3399,bool fpga_ver) { std::vector mats(mats_); - CImageApplySplit split(multioutputtype, is_msplit, is_multiout_red, colortype);; - - mats_.clear(); + + CImageApplySplit split(multioutputtype, is_msplit, is_multiout_red, colortype);; auto matexs = split.SplitMats(mats,is_duplex); + std::string filename ; int rotation01_ = 1; int rotation02_ = 1; @@ -341,9 +341,9 @@ namespace hg_imgproc int i = 0; for(auto &matex : matexs) { - cv::flip(matex.mat,matex.mat,rotation01_); + cv::flip(matex.mat, matex.mat, rotation01_); cv::flip(matex.mat,matex.mat,rotation02_); - if (i > 1 && (pid_ == 0x402 || pid_ == 0x100 || pid_ == 0x400)) + if (i > 1 && ((pid_ == 0x402) || pid_ == 0x100 || pid_ == 0x400)) { cv::flip(matex.mat,matex.mat,-1); } @@ -359,14 +359,14 @@ namespace hg_imgproc case 0x100: rotatetype = CImageApplyRotation::RotationType::Rotate_90_anti_clockwise; break; - case 0x402 || 0x400: + case 0x402: rotatetype = CImageApplyRotation::RotationType::Rotate_90_clockwise; break; case 0x400: rotatetype = CImageApplyRotation::RotationType::Rotate_90_clockwise; break; } - CImageApplyRotation Rotation(rotatetype,img_conf_.is_backrotate180,img_conf_.resolution_native,"./tessdata"); + CImageApplyRotation Rotation(rotatetype,false,img_conf_.resolution_native,"./tessdata"); Rotation.apply(mats_,img_conf_.is_duplex); } @@ -685,13 +685,14 @@ namespace hg_imgproc if (img_conf_.is_autotext) rotatetype = CImageApplyRotation::RotationType::AutoTextOrientation; -/*#if defined(WIN32) || defined(_WIN64) - char szIniFile[MAX_PATH] = {0}; - SHGetSpecialFolderPathA(NULL, szIniFile, CSIDL_WINDOWS, TRUE); - strcat(szIniFile, "\\twain_32\\HuaGoScan\\tessdata"); - // m_iaList.push_back(shared_ptr(new CImageApplyRotation(rotatetype, imgparams.BackRotate180, imgparams.DestResulution, szIniFile))); -#else // WIN32*/ - CImageApplyRotation Rotation(rotatetype,img_conf_.is_backrotate180,img_conf_.resolution_native,"./tessdata"); + + unsigned char back180 = false; + if (img_conf_.splitImage) + unsigned char back180 = false; + else + back180 = img_conf_.is_backrotate180; + + CImageApplyRotation Rotation(rotatetype, back180,img_conf_.resolution_native,"./tessdata"); Rotation.apply(mats,img_conf_.is_duplex); mats_ = mats;