239新增画质选项
This commit is contained in:
parent
c5e337ad06
commit
39f818a339
|
@ -142,6 +142,15 @@
|
|||
// #define HUAGAO_SETTING_STR_PERMAEATE_STRONGER "较强"
|
||||
#define HUAGAO_SETTING_STR_PERMAEATE_STRONGER "\350\276\203\345\274\272"
|
||||
|
||||
//画质
|
||||
|
||||
#define HUAGAO_SETTING_STR_IMG_NONE "无"
|
||||
// #define OPTION_VALUE_TXZL_ZL "速度优先"
|
||||
#define HUAGAO_SETTING_STR_IMG_SPEED "\351\200\237\345\272\246\344\274\230\345\205\210"
|
||||
// #define OPTION_VALUE_TXZL_XN "画质优先"
|
||||
#define HUAGAO_SETTING_STR_IMG_QUALITY "\347\224\273\350\264\250\344\274\230\345\205\210"
|
||||
|
||||
|
||||
// 公司名称 & 信息
|
||||
// #define COMPANY_NAME "宁波华高信息科技有限公司"
|
||||
#define COMPANY_NAME "\345\256\201\346\263\242\345\215\216\351\253\230\344\277\241\346\201\257\347\247\221\346\212\200\346\234\211\351\231\220\345\205\254\345\217\270"
|
||||
|
|
|
@ -105,8 +105,15 @@ g_permeate_lv[] =
|
|||
MAKE_STR_AND_ENUM(PERMAEATE_ORDINARY),
|
||||
MAKE_STR_AND_ENUM(PERMAEATE_STRONG),
|
||||
MAKE_STR_AND_ENUM(PERMAEATE_STRONGER)
|
||||
},
|
||||
g_img_quality[] =
|
||||
{
|
||||
MAKE_STR_AND_ENUM(IMG_NONE),
|
||||
MAKE_STR_AND_ENUM(IMG_SPEED),
|
||||
MAKE_STR_AND_ENUM(IMG_QUALITY)
|
||||
};
|
||||
|
||||
|
||||
static int match_best(struct _fixed_option* arr, size_t num, std::string& val, bool& exact)
|
||||
{
|
||||
exact = true;
|
||||
|
@ -250,6 +257,17 @@ int match_best_permaeate_lv(std::string& val, bool* exact)
|
|||
return ind;
|
||||
}
|
||||
|
||||
int match_best_img_quality(std::string& val, bool* exact)
|
||||
{
|
||||
bool yes = true;
|
||||
int ind = INVOKE_MATCH(g_img_quality, val, yes);
|
||||
|
||||
SET_DEFAULT_ON_FAIL(ind, val, IMG_SPEED);
|
||||
if (exact)
|
||||
*exact = yes;
|
||||
|
||||
return ind;
|
||||
}
|
||||
|
||||
std::string color_mode_string(int clr_mode)
|
||||
{
|
||||
|
@ -301,5 +319,7 @@ std::string is_permaeate_string(int permaeate_lv)
|
|||
{
|
||||
return INVOKE_STR(g_permeate_lv, permaeate_lv, 0);
|
||||
}
|
||||
|
||||
|
||||
std::string is_img_quality(int is_quakuty)
|
||||
{
|
||||
return INVOKE_STR(g_img_quality, is_quakuty, 0);
|
||||
}
|
|
@ -302,6 +302,15 @@ enum
|
|||
int match_best_permaeate_lv(std::string& val, bool* exact);
|
||||
std::string is_permaeate_string(int text_dir);
|
||||
|
||||
//画质
|
||||
enum
|
||||
{
|
||||
IMG_NONE = -1,
|
||||
IMG_SPEED ,
|
||||
IMG_QUALITY,
|
||||
};
|
||||
int match_best_img_quality(std::string& val, bool* exact);
|
||||
std::string is_img_quality(int is_quakuty);
|
||||
|
||||
typedef union _img_proc_fixed_param
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ hg_scanner::hg_scanner(ScannerSerial serial
|
|||
, bright_(128), contrast_(4), gamma_(1.0f), threshold_(40), anti_noise_(8), margin_(5)
|
||||
, fractate_level_(50), ui_ev_cb_(ui_default_callback), scan_life_(NULL)
|
||||
, notify_setting_result_(false), user_cancel_(false), cb_mem_(true), test_1_paper_(false)
|
||||
, setting_count_(0),img_type_(""), online_(false)
|
||||
, setting_count_(0),img_type_(""), online_(false),is_quality_(-1)
|
||||
{
|
||||
custom_gamma_val_ = new SANE_Gamma;
|
||||
memset(custom_gamma_val_, 0, sizeof(SANE_Gamma));
|
||||
|
@ -1407,6 +1407,20 @@ int hg_scanner::setting_custom_area_bottom(void* data)
|
|||
return HG_ERR_OK;
|
||||
}
|
||||
|
||||
int hg_scanner::setting_img_quality(void *data)
|
||||
{
|
||||
|
||||
std::string str((char*)data);
|
||||
bool exact = check_range(setting_map_[HG_BASE_SETTING_INDEX_IMG_QUALITY], str);
|
||||
int ret = exact ? HG_ERR_OK : HG_ERR_NOT_EXACT;
|
||||
|
||||
HG_VLOG_MINI_3(HG_LOG_LEVEL_DEBUG_INFO, "Change text direction from '%s' to '%s' = %s\n", is_img_quality(is_quality_).c_str()
|
||||
, (char*)data, hg_scanner::strerr((hg_err)ret).c_str());
|
||||
|
||||
is_quality_ = match_best_img_quality(str,NULL);
|
||||
on_resolution_changed(resolution_);
|
||||
}
|
||||
|
||||
int hg_scanner::on_color_mode_changed(int& color_mode)
|
||||
{
|
||||
return HG_ERR_OK;
|
||||
|
@ -1745,6 +1759,7 @@ int hg_scanner::set_setting(int setting_no, void* data, int len)
|
|||
, &hg_scanner::setting_page
|
||||
, &hg_scanner::setting_page_omit_empty
|
||||
, &hg_scanner::setting_resolution
|
||||
, &hg_scanner::setting_img_quality
|
||||
, &hg_scanner::setting_exchagnge
|
||||
, &hg_scanner::setting_split_image
|
||||
, &hg_scanner::setting_automatic_skew
|
||||
|
|
|
@ -47,7 +47,8 @@ enum
|
|||
HG_BASE_SETTING_INDEX_CUSTOM_AREA_BOTTOM, // 自定义区域下侧(mm)
|
||||
HG_BASE_SETTING_INDEX_PAGE, // 扫描页面
|
||||
HG_BASE_SETTING_INDEX_PAGE_OMIT_EMPTY_LEVEL, // 跳过空白页灵敏度
|
||||
HG_BASE_SETTING_INDEX_RESOLUTION, // 分辨率
|
||||
HG_BASE_SETTING_INDEX_RESOLUTION, // 分辨率
|
||||
HG_BASE_SETTING_INDEX_IMG_QUALITY, // 图像质量
|
||||
HG_BASE_SETTING_INDEX_EXCHANGE, // 交换正反面
|
||||
HG_BASE_SETTING_INDEX_SPLIT, // 图像拆分
|
||||
HG_BASE_SETTING_INDEX_AUTO_CORRECT, // 自动纠偏
|
||||
|
@ -179,6 +180,7 @@ protected:
|
|||
int setting_custom_area_top(void* data);
|
||||
int setting_custom_area_right(void* data);
|
||||
int setting_custom_area_bottom(void* data);
|
||||
int setting_img_quality(void *data);
|
||||
|
||||
|
||||
virtual int on_color_mode_changed(int& color_mode); // COLOR_MODE_xxx
|
||||
|
@ -229,6 +231,7 @@ protected:
|
|||
int fractate_level_; // 折角检测复杂度
|
||||
int scan_count_; // 扫描张数,各实例化类在重载set_setting_value中,如果发现该设置项对该参数有影响时,需要对此值作更改
|
||||
bool is_auto_matic_color;// 自动颜色识别
|
||||
int is_quality_; //画质设置
|
||||
|
||||
SCANCONF img_conf_; //此参数外部不做任何改变,请在writedown_image_configuration做修改
|
||||
std::string img_type_;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -587,7 +587,7 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
|
|||
/////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
|
||||
int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]);
|
||||
|
||||
unsigned char buffer1[256 *3];
|
||||
unsigned char buffer_re[256 *3];
|
||||
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY)
|
||||
tableLength = 256;
|
||||
else
|
||||
|
@ -609,18 +609,17 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
|
|||
memcpy(buf_03,custom_gamma_val_->table + index,buffersize);
|
||||
index += buffersize;
|
||||
|
||||
int j =0;
|
||||
for (size_t i = 0; i < buffersize; i++)
|
||||
int j = 0;
|
||||
for (size_t i = 0;i < buffersize;i++)
|
||||
{
|
||||
memcpy(buffer1 + j,buf_01 + i,1);
|
||||
memcpy(buffer1 + (++j),buf_02 + i,1);
|
||||
memcpy(buffer1 + (++j),buf_03 + i,1);
|
||||
memcpy(buffer_re + j,buf_01 + i,1);
|
||||
memcpy(buffer_re + (++j),buf_02 + i,1);
|
||||
memcpy(buffer_re + (++j),buf_03 + i,1);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hg_imgproc::customgamma(handle,custom_gamma_,buffer1,tableLength);
|
||||
|
||||
hg_imgproc::customgamma(handle,custom_gamma_,buffer_re,tableLength);
|
||||
|
||||
if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue