添加402 图像处理逻辑

This commit is contained in:
13038267101 2023-06-14 09:27:50 +08:00
parent 9b33f7fc19
commit 80da6b8c1c
1 changed files with 13 additions and 17 deletions

View File

@ -486,7 +486,7 @@ namespace hg_imgproc
buffer_.reset(new std::vector<char >()); buffer_.reset(new std::vector<char >());
int i=0; int i=0;
vector<cv::Mat>Temp_mat; vector<cv::Mat >Temp_mat;
for (auto& buf : buffs) for (auto& buf : buffs)
{ {
i++; i++;
@ -527,10 +527,10 @@ namespace hg_imgproc
Temp_mat.push_back(mat); Temp_mat.push_back(mat);
//cv::imwrite(std::to_string(i)+"_decode.jpg",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))); //front
Temp_mat.push_back(mat(cv::Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows))); Temp_mat.push_back(mat(cv::Rect(0, 0, mat.cols / 2, mat.rows))); //back
} }
buffer_.reset(new std::vector<char >()); buffer_.reset(new std::vector<char >());
@ -543,8 +543,12 @@ namespace hg_imgproc
} }
buffs.clear(); 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; double left = img_conf_.fillholeratio_left / 100.0;
@ -552,17 +556,10 @@ namespace hg_imgproc
double top = img_conf_.fillholeratio_up / 100.0; double top = img_conf_.fillholeratio_up / 100.0;
double low = img_conf_.fillholeratio_down / 100.0; double low = img_conf_.fillholeratio_down / 100.0;
if (left > 0 || right > 0 || top > 0 || low > 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()); 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) if (img_conf_.is_duplex)
{ {
mats_.push_back(img_conf_.is_switchfrontback ? Temp_mat[1] : Temp_mat[0]); mats_.push_back(img_conf_.is_switchfrontback ? Temp_mat[1] : Temp_mat[0]);
@ -576,7 +573,6 @@ namespace hg_imgproc
mats_ = Temp_mat; mats_ = Temp_mat;
} }
Temp_mat.clear(); Temp_mat.clear();
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size()); VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size());