439处理图像流程
This commit is contained in:
parent
b034c13abb
commit
14b35d1a2b
|
@ -405,7 +405,7 @@ int hg_scanner_239::writedown_image_configuration(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (scan_count_ == -1)
|
||||
if (scan_count_ == -1 || is_auto_paper_scan)
|
||||
ic.scannum = -1;
|
||||
else
|
||||
ic.scannum = (ic.is_duplex ? scan_count_ * 2 : scan_count_);
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace hg_imgproc
|
|||
}
|
||||
~imgproc()
|
||||
{
|
||||
//free_auto_txt_hanld();
|
||||
free_auto_txt_hanld();
|
||||
}
|
||||
|
||||
// load data
|
||||
|
@ -443,7 +443,6 @@ namespace hg_imgproc
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int free_auto_txt_hanld()
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -486,7 +485,7 @@ namespace hg_imgproc
|
|||
std::vector<std::shared_ptr<std::vector<char>>> buffs;
|
||||
if(pid == 0x100 || pid == 0x200)
|
||||
buffs = G200Decode(buffer_,img_conf_.is_duplex,img_conf_.is_switchfrontback).getImageBuffs();
|
||||
else if(pid == 0x139 || pid == 0x239)
|
||||
else if(pid == 0x139 || pid == 0x239 ||pid == 0x439)
|
||||
buffs = GRawDecode(buffer_).getImageBuffs();
|
||||
else if(pid == 0x300 || pid == 0x400 ||pid == 0x402)
|
||||
buffs = G400Decode(buffer_,img_conf_.is_duplex).getImageBuffs();
|
||||
|
@ -526,7 +525,7 @@ namespace hg_imgproc
|
|||
LOG_INFO(LOG_LEVEL_FATAL, "decode image data error\n");
|
||||
continue;
|
||||
}
|
||||
if(pid == 0x100 || pid == 0x200 || pid == 0x139 || pid == 0x239)
|
||||
if (pid == 0x100 || pid == 0x200 || pid == 0x139 || pid == 0x239 || pid_ == 0x439)
|
||||
{
|
||||
mats_.push_back(mat);
|
||||
//cv::imwrite(std::to_string(i)+"_decode.jpg",mat);
|
||||
|
@ -593,7 +592,7 @@ namespace hg_imgproc
|
|||
std::string filename ;
|
||||
int rotation01_ = 1;
|
||||
int rotation02_ = 1;
|
||||
if((pid_ == 0x139 || pid_ == 0x239 || pid_ == 0x100 || pid_ == 0x200) && (split3399 % 2 ==0) && img_conf_.is_duplex)
|
||||
if((pid_ == 0x139 || pid_ == 0x239 || pid_ == 0x100 || pid_ == 0x200 || pid_ == 0x439) && (split3399 % 2 ==0) && img_conf_.is_duplex)
|
||||
{
|
||||
rotation01_ = 0;
|
||||
rotation02_ = 1;
|
||||
|
@ -613,7 +612,7 @@ namespace hg_imgproc
|
|||
}
|
||||
CImageApplyRotation::RotationType rotatetype = CImageApplyRotation::RotationType::Invalid;
|
||||
|
||||
if (pid_ == 0x402 || pid_ == 0x400 || pid_ == 0x239)
|
||||
if (pid_ == 0x402 || pid_ == 0x400 || pid_ == 0x239 || pid_ == 0x439)
|
||||
rotatetype = CImageApplyRotation::RotationType::Rotate_90_clockwise;
|
||||
else if(pid_ == 0x100)
|
||||
rotatetype = CImageApplyRotation::RotationType::Rotate_90_anti_clockwise;
|
||||
|
@ -651,61 +650,6 @@ namespace hg_imgproc
|
|||
}
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
int multi_out(void)
|
||||
{
|
||||
std::vector<cv::Mat> mats(mats_);
|
||||
|
||||
mats_.clear();
|
||||
for (size_t i = 0; i < mats.size(); ++i)
|
||||
{
|
||||
if (mats[i].empty())
|
||||
continue;
|
||||
|
||||
vector<cv::Mat> retmats;
|
||||
std::vector<std::shared_ptr<IMulti>> m_multiprc_list;
|
||||
int multiout = 1,
|
||||
colormode = 1;
|
||||
|
||||
//if (m_param.imageProcess.filter == ColorFilter::FILTER_NONE)
|
||||
//{
|
||||
// colormode = m_param.pixelType;
|
||||
//}
|
||||
if (param_.channels > 1)
|
||||
m_multiprc_list.push_back(shared_ptr<IMulti>(new ImageMultiOutputRed(2)));
|
||||
m_multiprc_list.push_back(shared_ptr<IMulti>(new IMageMulti(multiout)));
|
||||
for (int j = 0; j < m_multiprc_list.size(); j++)
|
||||
{
|
||||
retmats = m_multiprc_list[j]->apply(mats[i]);
|
||||
}
|
||||
|
||||
CImageApplySplit isp(multiout, false, 1, colormode);
|
||||
if (!retmats.size())
|
||||
{
|
||||
std::vector<cv::Mat> matse;
|
||||
matse.push_back(mats[i]);
|
||||
auto matexs = isp.SplitMats(matse, img_conf_.is_duplex);
|
||||
for (auto& matex : matexs)
|
||||
{
|
||||
mats_.push_back(matex.mat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto matexs = isp.SplitMats(retmats, img_conf_.is_duplex);
|
||||
for (auto& matex : matexs)
|
||||
{
|
||||
mats_.push_back(matex.mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mats_.empty())
|
||||
{
|
||||
return SCANNER_ERR_NO_DATA;
|
||||
}
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
int multi_out(int out_type)
|
||||
{
|
||||
std::vector<cv::Mat> mats(mats_);
|
||||
|
@ -1203,10 +1147,6 @@ namespace hg_imgproc
|
|||
}
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
|
||||
#endif
|
||||
#define test
|
||||
int ocr_auto_txtdirect()
|
||||
{
|
||||
std::vector<cv::Mat> mats(mats_);
|
||||
|
@ -1470,7 +1410,6 @@ namespace hg_imgproc
|
|||
//printf("pimh->channels = %d \r\n",pimh->channels);
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
|
||||
int get_final_data(LPIMGHEAD pimh, std::vector<unsigned char>* buf, int index)
|
||||
{
|
||||
if ((index < 0 || index >= mats_.size()))
|
||||
|
@ -1510,7 +1449,6 @@ namespace hg_imgproc
|
|||
//printf("pimh->channels_01 = %d \r\n",pimh->channels);
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
|
||||
int imgtypechange(std::string img_type_,void *buf,std::vector<unsigned char> &bmpdata)
|
||||
{
|
||||
int ret = SCANNER_ERR_OK;
|
||||
|
@ -1521,7 +1459,6 @@ namespace hg_imgproc
|
|||
cv::imencode(img_type_,*((cv::Mat*)buf),bmpdata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void dump_2_file(const char* local_file)
|
||||
{
|
||||
if (mats_.size())
|
||||
|
@ -1557,7 +1494,6 @@ namespace hg_imgproc
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// api ...
|
||||
HIMGPRC init(int pid,bool isx86_Advan_)
|
||||
|
@ -1574,7 +1510,6 @@ namespace hg_imgproc
|
|||
{
|
||||
return ((imgproc*)himg)->load_file(path_file);
|
||||
}
|
||||
|
||||
int decode(HIMGPRC himg, int pid, LPSCANCONF img_param, LPIMGPRCPARAM param)
|
||||
{
|
||||
return ((imgproc*)himg)->decode(pid, img_param, param);
|
||||
|
@ -1603,12 +1538,10 @@ namespace hg_imgproc
|
|||
{
|
||||
return ((imgproc*)himg)->multi_out();
|
||||
}
|
||||
|
||||
int multi_out(HIMGPRC himg,int out_type)
|
||||
{
|
||||
return ((imgproc*)himg)->multi_out(out_type);
|
||||
}
|
||||
|
||||
int multi_out_red(HIMGPRC himg)
|
||||
{
|
||||
return ((imgproc*)himg)->multi_out_red();
|
||||
|
@ -1677,7 +1610,6 @@ namespace hg_imgproc
|
|||
{
|
||||
return ((imgproc*)himg)->answerSheetFilterRed();
|
||||
}
|
||||
|
||||
//img_type_ = jpg png bmp
|
||||
int imgtypechange(HIMGPRC himg,std::string img_type_,void *buf,std::vector<unsigned char> &bmpdata)
|
||||
{
|
||||
|
@ -1703,17 +1635,14 @@ namespace hg_imgproc
|
|||
{
|
||||
return ((imgproc*)himg)->size_detection();
|
||||
}
|
||||
|
||||
int final(HIMGPRC himg)
|
||||
{
|
||||
return ((imgproc*)himg)->final();
|
||||
}
|
||||
|
||||
int get_final_data(HIMGPRC himg, LPIMGHEAD pimh, void** buf, int index)
|
||||
{
|
||||
return ((imgproc*)himg)->get_final_data(pimh, buf, index);
|
||||
}
|
||||
|
||||
int get_final_data(HIMGPRC himg, LPIMGHEAD pimh, std::vector<unsigned char>* buf, int index)
|
||||
{
|
||||
return ((imgproc*)himg)->get_final_data(pimh, buf, index);
|
||||
|
@ -1722,14 +1651,12 @@ namespace hg_imgproc
|
|||
{
|
||||
((imgproc*)himg)->dump_2_file(local_file);
|
||||
}
|
||||
|
||||
void release(HIMGPRC himg)
|
||||
{
|
||||
imgproc* obj = (imgproc*)himg;
|
||||
|
||||
delete obj;
|
||||
}
|
||||
|
||||
// seperate utilites ...
|
||||
static cv::Mat from_bmp_file_bits(const BITMAPINFOHEADER& bih, unsigned char* data, bool line_reverse, bool bw_reverse)
|
||||
{
|
||||
|
@ -2012,7 +1939,6 @@ namespace hg_imgproc
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char reverse_bit(unsigned char v)
|
||||
{
|
||||
unsigned char r = 0;
|
||||
|
|
Loading…
Reference in New Issue