BGR转换

This commit is contained in:
mo1027728827@qq.com 2022-05-07 18:25:03 +08:00
parent b25ae0a7c2
commit 6872b61b53
3 changed files with 102 additions and 6 deletions

View File

@ -628,8 +628,40 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n"); //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n");
} }
/////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// /////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]);
hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength);
unsigned char buffer1[256 *3];
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY)
tableLength = 256;
else
{
tableLength = 768;
int index=0;
unsigned char buf_01[256];
memcpy(buf_01,custom_gamma_val_->table + index,256);
index += 256;
unsigned char buf_02[256];
memcpy(buf_02,custom_gamma_val_->table + index,256);
index += 256;
unsigned char buf_03[256];
memcpy(buf_03,custom_gamma_val_->table + index,256);
index += 256;
int j =0;
for (size_t i = 0; i < 256; i++)
{
memcpy(buffer1 + j,buf_01 + i,1);
memcpy(buffer1 + (++j),buf_02 + i,1);
memcpy(buffer1 + (++j),buf_03 + i,1);
++j;
}
}
hg_imgproc::customgamma(handle,custom_gamma_,buffer1,tableLength);
if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect)
{ {

View File

@ -585,8 +585,40 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n"); //HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n");
} }
/////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// /////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]);
hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength);
unsigned char buffer1[256 *3];
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY)
tableLength = 256;
else
{
tableLength = 768;
int index=0;
unsigned char buf_01[256];
memcpy(buf_01,custom_gamma_val_->table + index,256);
index += 256;
unsigned char buf_02[256];
memcpy(buf_02,custom_gamma_val_->table + index,256);
index += 256;
unsigned char buf_03[256];
memcpy(buf_03,custom_gamma_val_->table + index,256);
index += 256;
int j =0;
for (size_t i = 0; i < 256; i++)
{
memcpy(buffer1 + j,buf_01 + i,1);
memcpy(buffer1 + (++j),buf_02 + i,1);
memcpy(buffer1 + (++j),buf_03 + i,1);
++j;
}
}
hg_imgproc::customgamma(handle,custom_gamma_,buffer1,tableLength);
if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect)
{ {

View File

@ -588,8 +588,40 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
//HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner::strerr((hg_err)ret).c_str()); //HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO, "除色开启:%s\n",hg_scanner::strerr((hg_err)ret).c_str());
} }
/////////////////////////////////////2222222222222222222222222222222222222////////////////////////////////// /////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
int tableLength = sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]); int tableLength ;//= sizeof(custom_gamma_val_->table)/sizeof(custom_gamma_val_->table[0]);
hg_imgproc::customgamma(handle,custom_gamma_,custom_gamma_val_->table,tableLength);
unsigned char buffer1[256 *3];
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY)
tableLength = 256;
else
{
tableLength = 768;
int index=0;
unsigned char buf_01[256];
memcpy(buf_01,custom_gamma_val_->table + index,256);
index += 256;
unsigned char buf_02[256];
memcpy(buf_02,custom_gamma_val_->table + index,256);
index += 256;
unsigned char buf_03[256];
memcpy(buf_03,custom_gamma_val_->table + index,256);
index += 256;
int j =0;
for (size_t i = 0; i < 256; i++)
{
memcpy(buffer1 + j,buf_01 + i,1);
memcpy(buffer1 + (++j),buf_02 + i,1);
memcpy(buffer1 + (++j),buf_03 + i,1);
++j;
}
}
hg_imgproc::customgamma(handle,custom_gamma_,buffer1,tableLength);
if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect) if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect)
{ {