把图像处理提至基类进行处理

This commit is contained in:
13038267101 2022-10-17 18:15:29 +08:00
parent 1c9eb34146
commit c357e847bd
17 changed files with 343 additions and 68 deletions

View File

@ -98,7 +98,7 @@ hg_scanner::hg_scanner(ScannerSerial serial
, double_paper_handle_(0), keep_watermark_(false), save_feedmode_type_(false), feedmode_(1), sleeptime_(-1),split3399_(0)
, async_io_(false), is_white_0_(true), isremove_left_hole(false), isremove_right_hole(false), isremove_top_hole(false), isremove_low_hole(false)
, isremove_left_hole_threshold(0), isremove_right_hole_threshold(0), isremove_top_hole_threshold(0), isremove_low_hole_threshold(0)
, dump_usb_path_("")
, dump_usb_path_(""),is_kernelsnap_211209_(false), pid_(0)
{
final_path_ = hg_log::ini_get("paths", "final_img");
if(final_path_.empty())
@ -3257,3 +3257,193 @@ int hg_scanner::get_scan_is_sleep(void)
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
}
void hg_scanner::image_process(std::shared_ptr<tiny_buffer>& buffer)
{
int ret = SCANNER_ERR_OK;
hg_imgproc::HIMGPRC handle = get_image_process_object(pid_);
hg_imgproc::IMGHEAD ih;
int err = SCANNER_ERR_OK,
index = 0;
void* buf = NULL;
hg_imgproc::load_buffer(handle, buffer);
hg_imgproc::decode(handle, pid_);
if ((isremove_left_hole || isremove_right_hole || isremove_top_hole || isremove_low_hole) && (pid_ != 0x239 && pid_ != 0x439))
{
ret = hg_imgproc::fillhole(handle, isremove_top_hole_threshold, isremove_low_hole_threshold, isremove_left_hole_threshold, isremove_right_hole_threshold);
}
/////////////////////////////////////111111111111111111111111111//////////////////////////////////
if (pid_ != 0x239 && pid_ != 0x439)
ret = hg_imgproc::auto_crop(handle); //首次必须先调用这个算法
if ((img_conf_.is_autodiscradblank_normal || img_conf_.is_autodiscradblank_vince) && (pid_ != 0x239 && pid_ != 0x439))
{
ret = hg_imgproc::discardBlank(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"丢弃空白页开启\r\n");
}
if (img_conf_.fadeback) //239
{
hg_imgproc::fadeback(handle, img_conf_.fadebackrange, img_conf_.is_duplex);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"背景除色开启\r\n");
}
if ((img_conf_.resolution_dst != img_conf_.resolution_native) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::resolution_change(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"dpi改变开启\r\n");
}
if ((img_conf_.cropRect.enable && !img_conf_.is_autocrop) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::croprect(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"手动裁图开启\r\n");
}
if ((img_conf_.filter != ColorFilter::FILTER_NONE && (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY)) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::channel(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n");
}
/////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
if (pid_ != 0x239 && pid_ != 0x439)
{
adjust_color(handle);
}
if ((img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::answerSheetFilterRed(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"答题卡出红开启\r\n");
}
if ((img_conf_.refuseInflow) && (pid_ != 0x239 && pid_ != 0x439))
{
int lv = 5;
if (image_prc_param_.bits.is_permeate_lv_ == 0)
lv = 5;
else if (image_prc_param_.bits.is_permeate_lv_ == 1)
lv = 15;
else if (image_prc_param_.bits.is_permeate_lv_ == 2)
lv = 25;
else if (image_prc_param_.bits.is_permeate_lv_ == 3)
lv = 35;
else if (image_prc_param_.bits.is_permeate_lv_ == 4)
lv = 45;
hg_imgproc::antiInflow(handle, lv);
}
if ((img_conf_.colorCorrection && img_conf_.pixtype != COLOR_MODE_BLACK_WHITE) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::colorCorrection(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"颜色校正开启\r\n");
}
if (((img_conf_.imageRotateDegree != TEXT_DIRECTION_0 || img_conf_.is_backrotate180) && (!img_conf_.is_autotext)) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::orentation(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"自动旋转开启\r\n");
}
if ((img_conf_.removeMorr) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::textureRemove(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除摩尔纹开启\r\n");
}
if ((img_conf_.detachnoise.is_detachnoise) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::nosieDetach(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"噪点优化开启\r\n");
}
if ((img_conf_.pixtype == COLOR_MODE_BLACK_WHITE) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::errorextention(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"黑白图处理开启\r\n");
}
if ((img_conf_.en_fold) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::fold(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"对折开启\r\n");
}
///////////////////////////////////
if (img_conf_.multi_output_red && img_conf_.pixtype == COLOR_MODE_24_BITS)//239
{
err = hg_imgproc::multi_out_red(handle);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"多流出红开启\r\n");
}
if ((img_conf_.sharpen) && (pid_ != 0x239 && pid_ != 0x439))
{
hg_imgproc::sharpenType(handle);
}
if (image_prc_param_.bits.split) //239
{
split3399_++;
int colormode = 1;
if (img_conf_.filter == RID_COLOR_NONE)
colormode = img_conf_.pixtype;
err = hg_imgproc::split(handle, img_conf_.multiOutput, img_conf_.splitImage, img_conf_.multi_output_red, colormode, img_conf_.is_duplex, split3399_, is_kernelsnap_211209_);
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
, img_conf_.multiOutput
, img_conf_.splitImage
, img_conf_.multi_output_red
, img_conf_.pixtype
, img_conf_.is_duplex);
}
if (!img_conf_.splitImage || !img_conf_.multi_output_red || !is_multiout) //239
{
if (img_conf_.automaticcolor)
{
hg_imgproc::auto_matic_color(handle, img_conf_.automaticcolortype);
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"颜色自动识别开启\r\n");
}
}
if (img_conf_.is_autotext)//239
{
printf("文本方向自动识别\r\n");
hg_imgproc::ocr_auto_txtdirect(handle);
}
if (is_quality_ == IMG_SPEED && resolution_ >= 300)//239
{
err = hg_imgproc::quality(handle, resolution_);
}
//多流输出最后处理
if (is_multiout)//239
{
int multi_out = img_conf_.multiOutput;
err = hg_imgproc::multi_out(handle, multi_out);
}
hg_imgproc::final(handle);
while (hg_imgproc::get_final_data(handle, &ih, &buf, index++) == SCANNER_ERR_OK)
{
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
if (!img_type_.empty())
{
std::vector<unsigned char>bmpdata;
//cv::imencode(img_type_,*((cv::Mat*)buf),bmpdata);
hg_imgproc::imgtypechange(handle, img_type_, buf, bmpdata);
if (bmpdata.empty())
{
status_ = SCANNER_ERR_NO_DATA;
return;
}
buf = bmpdata.data();
ih.total_bytes = bmpdata.size();
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n", img_type_.c_str(), index
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
}
save_final_image(&ih, buf);
}
hg_imgproc::release(handle);
}

View File

@ -67,7 +67,7 @@ class hg_scanner
void working_done(void*);
void image_process(std::shared_ptr<tiny_buffer>& buff);
void reset_custom_area_range(int paper);
int set_color_change(void);
@ -189,7 +189,6 @@ protected:
virtual int set_setting_value(int setting_no, void* data, int len);
virtual int on_scanner_closing(bool force);
virtual void thread_handle_usb_read(void) = 0;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) = 0;
// adjust color or apply custom gamma
void adjust_color(hg_imgproc::HIMGPRC handle);
@ -252,6 +251,8 @@ protected:
double isremove_low_hole_threshold; //设置下边除穿孔阈值
int split3399_; //3399设备正面和反面图像是相对的所以对折时反面需要进行特殊处理
int pid_;
bool is_kernelsnap_211209_; //获取固件版本号是否是新旧版本
SCANCONF img_conf_; //此参数外部不做任何改变请在writedown_image_configuration做修改
std::string img_type_;

View File

@ -214,8 +214,9 @@ enum hg_239_setting_item
hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io), pid_(pid)
hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io)
{
pid_ = pid;
string fw = get_firmware_version();
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_firmware_version is: %s\n",fw.c_str());
initdevice();

View File

@ -26,7 +26,7 @@ class hg_scanner_200 : public hg_scanner
protected:
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) ;
virtual int on_color_mode_changed(int& color_mode); // COLOR_MODE_xxx
@ -63,9 +63,6 @@ private:
HGSCANCONF_DSP dsp_config_;
int agreement();
private:
int pid_;
public:
virtual int set_leaflet_scan(void);//单张扫描
virtual int get_abuot_info(void);//获取软件关于信息

View File

@ -442,8 +442,9 @@ enum PaperSize_
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// class ...
hg_scanner_239::hg_scanner_239(const char* dev_name, int pid,usb_io* io) : hg_scanner(G20039Serial, dev_name, io)
, rewrite_conf_(false), reset_(false),pid_(pid),is_start_status(false)
, rewrite_conf_(false), reset_(false),is_start_status(false)
{
pid_ = pid;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_239(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
dev_conf_.value = 0;
#ifndef MAPPING_FUNCTION_IN_BASE
@ -733,7 +734,6 @@ void hg_scanner_239::image_process(std::shared_ptr<tiny_buffer>& buff)
}
if (img_conf_.is_autotext)
{
printf("文本方向自动识别11111\r\n");
hg_imgproc::ocr_auto_txtdirect(handle);
}
if (is_quality_ == IMG_SPEED && resolution_ >= 300)

View File

@ -23,11 +23,9 @@ class hg_scanner_239 : public hg_scanner
//BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> final_imgs_; // JPG ...
// image_data final_imgs_; // JPG ..
int pid_;
HGSCANCONF dev_conf_;
bool rewrite_conf_;
bool reset_;
bool is_kernelsnap_211209_;
bool is_start_status;
int read_register(int addr, int* val);
@ -79,7 +77,7 @@ protected:
virtual void on_device_reconnected(void) override;
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) ;
public:
hg_scanner_239(const char* dev_name, int pid,usb_io* io);

View File

@ -193,8 +193,9 @@ enum hg_239_setting_item
hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),pid_(pid),papersize(pid)
hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),papersize(pid)
{
pid_ = pid;
string fw = get_firmware_version();
initdevice();

View File

@ -25,7 +25,7 @@ class hg_scanner_300 : public hg_scanner
protected:
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) ;
virtual int on_color_mode_changed(int& color_mode); // COLOR_MODE_xxx
@ -64,7 +64,6 @@ private:
virtual std::string get_serial_num(void) override;
private:
int pid_;
std::vector<int> savestatus_;
HGSCANCONF_G400 dsp_config;
Device::PaperSize papersize;

View File

@ -414,8 +414,9 @@ enum PaperSize_
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// class ...
hg_scanner_302::hg_scanner_302(const char* dev_name, int pid,usb_io* io) : hg_scanner(G20039Serial, dev_name, io)
, rewrite_conf_(false), reset_(false),pid_(pid)
, rewrite_conf_(false), reset_(false)
{
pid_ = pid;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_302(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
dev_conf_.value = 0;
#ifndef MAPPING_FUNCTION_IN_BASE

View File

@ -23,11 +23,9 @@ class hg_scanner_302 : public hg_scanner
//BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> final_imgs_; // JPG ...
// image_data final_imgs_; // JPG ..
int pid_;
HGSCANCONF dev_conf_;
bool rewrite_conf_;
bool reset_;
bool is_kernelsnap_211209_;
int read_register(int addr, int* val);
int write_register(int addr, int val);
@ -73,7 +71,7 @@ protected:
virtual void on_device_reconnected(void) override;
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) ;
public:
hg_scanner_302(const char* dev_name, int pid,usb_io* io);

View File

@ -193,8 +193,9 @@ enum hg_239_setting_item
hg_scanner_400::hg_scanner_400(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),pid_(pid),papersize(pid)
hg_scanner_400::hg_scanner_400(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),papersize(pid)
{
pid_ = pid;
string fw = get_firmware_version();
initdevice();

View File

@ -25,7 +25,7 @@ class hg_scanner_400 : public hg_scanner
protected:
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) ;
virtual int on_color_mode_changed(int& color_mode); // COLOR_MODE_xxx
@ -66,7 +66,6 @@ private:
private:
int pid_;
HGSCANCONF_G400 dsp_config;
Device::PaperSize papersize;

View File

@ -418,8 +418,9 @@ enum PaperSize_
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// class ...
hg_scanner_402::hg_scanner_402(const char* dev_name, int pid,usb_io* io) : hg_scanner(G20039Serial, dev_name, io)
, rewrite_conf_(false), reset_(false),pid_(pid)
, rewrite_conf_(false), reset_(false)
{
pid_ = pid;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_402(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
dev_conf_.value = 0;
#ifndef MAPPING_FUNCTION_IN_BASE

View File

@ -23,11 +23,9 @@ class hg_scanner_402 : public hg_scanner
//BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> final_imgs_; // JPG ...
// image_data final_imgs_; // JPG ..
int pid_;
HGSCANCONF dev_conf_;
bool rewrite_conf_;
bool reset_;
bool is_kernelsnap_211209_;
int read_register(int addr, int* val);
int write_register(int addr, int val);
@ -73,7 +71,7 @@ protected:
virtual void on_device_reconnected(void) override;
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff);
public:
hg_scanner_402(const char* dev_name, int pid,usb_io* io);

View File

@ -412,8 +412,9 @@ enum PaperSize_
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// class ...
hg_scanner_439::hg_scanner_439(const char* dev_name, int pid,usb_io* io) : hg_scanner(G20039Serial, dev_name, io)
, rewrite_conf_(false), reset_(false),pid_(pid)
, rewrite_conf_(false), reset_(false)
{
pid_ = pid;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "hg_scanner_439(%s) constructing ...\n", hg_log::format_ptr(this).c_str());
dev_conf_.value = 0;
#ifndef MAPPING_FUNCTION_IN_BASE

View File

@ -23,11 +23,9 @@ class hg_scanner_439 : public hg_scanner
//BlockingQueue<std::shared_ptr<std::vector<unsigned char>>> final_imgs_; // JPG ...
// image_data final_imgs_; // JPG ..
int pid_;
HGSCANCONF dev_conf_;
bool rewrite_conf_;
bool reset_;
bool is_kernelsnap_211209_;
int read_register(int addr, int* val);
int write_register(int addr, int val);
@ -70,7 +68,7 @@ protected:
virtual void on_device_reconnected(void) override;
virtual int on_scanner_closing(bool force) override;
virtual void thread_handle_usb_read(void) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff) override;
virtual void image_process(std::shared_ptr<tiny_buffer>& buff);
public:
hg_scanner_439(const char* dev_name, int pid,usb_io* io);

View File

@ -306,7 +306,7 @@ namespace hg_imgproc
}
buffs.clear();
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size());
if(mats_.size() == 0)
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
@ -320,6 +320,10 @@ namespace hg_imgproc
rot.apply(mats_, img_conf_.is_duplex);
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
@ -353,8 +357,6 @@ namespace hg_imgproc
mats_.push_back(matex.mat);
i++;
}
if(fpga_ver)
{
CImageApplyRotation::RotationType rotatetype = CImageApplyRotation::RotationType::Invalid;
switch (pid_)
{
@ -370,8 +372,10 @@ namespace hg_imgproc
}
CImageApplyRotation Rotation(rotatetype,false,img_conf_.resolution_native,"./tessdata");
Rotation.apply(mats_,img_conf_.is_duplex);
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int fadeback(int range,bool is_duplex)
@ -393,6 +397,10 @@ namespace hg_imgproc
}
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int multi_out(void)
@ -444,6 +452,10 @@ namespace hg_imgproc
}
}
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
@ -468,6 +480,10 @@ namespace hg_imgproc
// cv::imwrite(filename,mat[j]);
}
}
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int multi_out_red()
@ -491,6 +507,10 @@ namespace hg_imgproc
// cv::imwrite(filename,mats_[i]);
// printf("fadeback.size :%d ,filename is =%s\r\n",mats_.size(),filename.c_str());
}
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int auto_matic_color(int color_type)
@ -508,7 +528,11 @@ namespace hg_imgproc
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
/*pixtype 0 colcor; 1 gray; 2 bw*/
int auto_crop()
@ -525,7 +549,11 @@ namespace hg_imgproc
mats_ = mats;
//cv::imwrite("/home/huagao/Desktop/mats_.jpg",mats_[0]);
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int fillhole(float top,float low,float l,float r)
{
@ -545,7 +573,11 @@ namespace hg_imgproc
outh.apply(mats,img_conf_.is_duplex);
mats_ = mats;
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int resolution_change()
{
@ -570,7 +602,11 @@ namespace hg_imgproc
if(!mats.empty())
mats_ = mats;
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int croprect()
{
@ -585,7 +621,11 @@ namespace hg_imgproc
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int channel()
{
@ -601,7 +641,11 @@ namespace hg_imgproc
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int adjust_color(unsigned char* gamma_table = nullptr, int tableLength = 0)
{
@ -632,9 +676,13 @@ namespace hg_imgproc
//cv::imwrite("/home/huagao/Desktop/customgamma2.jpg",mats_[0]);
}
mats_ = mats;
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
//防止渗�?
return SCANNER_ERR_OK;
}
int antiInflow(int permeate_lv)
{
int ret = SCANNER_ERR_OK;
@ -648,9 +696,13 @@ namespace hg_imgproc
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
//色彩校正
return SCANNER_ERR_OK;
}
int colorCorrection()
{
int ret = SCANNER_ERR_OK;
@ -661,9 +713,13 @@ namespace hg_imgproc
con.apply(mats,img_conf_.is_duplex);
mats_= mats;
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
//å¾åƒ<C3A5>æ—转
return SCANNER_ERR_OK;
}
int orentation()
{
int ret = SCANNER_ERR_OK;
@ -702,10 +758,13 @@ namespace hg_imgproc
Rotation.apply(mats,img_conf_.is_duplex);
mats_ = mats;
//#endif
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
//除网�
return SCANNER_ERR_OK;
}
int textureRemove()
{
int ret = SCANNER_ERR_OK;
@ -717,9 +776,12 @@ namespace hg_imgproc
Removal.apply(mats,img_conf_.is_duplex);
mats_ = mats;
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
//é”<C3A9>åŒ
int sharpenType()
{
int ret = SCANNER_ERR_OK;
@ -733,9 +795,12 @@ namespace hg_imgproc
Filte.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
//é»ç™½é™<C3A9>噪
int nosieDetach()
{
int ret = SCANNER_ERR_OK;
@ -748,10 +813,13 @@ namespace hg_imgproc
Noise.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
//错误扩散
int errorextention()
{
int ret = SCANNER_ERR_OK;
@ -770,7 +838,11 @@ namespace hg_imgproc
BWBinaray.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int discardBlank()
@ -794,9 +866,12 @@ namespace hg_imgproc
else
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
//答题å<CB9C>¡å‡ºï¿?
int answerSheetFilterRed()
{
int ret = SCANNER_ERR_OK;
@ -809,7 +884,11 @@ namespace hg_imgproc
correct.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
//对折
int fold()
@ -822,7 +901,11 @@ namespace hg_imgproc
fold.apply(mats,img_conf_.is_duplex);
mats_= mats;
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
//画质
@ -840,6 +923,10 @@ namespace hg_imgproc
cv::resize(mats[i],out, cv::Size(),xy,xy);
mats_.push_back(out);
}
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
#ifdef _WIN32
@ -929,7 +1016,11 @@ namespace hg_imgproc
#else
#endif
return ret;
if (mats_.empty())
{
return SCANNER_ERR_NO_DATA;
}
return SCANNER_ERR_OK;
}
int size_detection()
{