新增图像颜色切换

This commit is contained in:
13038267101 2023-02-08 15:25:54 +08:00
parent 035d90e714
commit 2c4daa8f95
2 changed files with 55 additions and 8 deletions

View File

@ -26,7 +26,7 @@ static struct Test_Map
{HGPDTTOOLDB_NAME_SCANNING_SENSOR ,HGPDTTOOLDB_TITLE_SCANNING_SENSOR},
{HGPDTTOOLDB_NAME_PLACE_CORRECTION_PAPER ,HGPDTTOOLDB_TITLE_PLACE_CORRECTION_PAPER},
{HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD ,HGPDTTOOLDB_TITLE_AUTO_FLAT_FIELD},
{HGPDTTOOLDB_NAME_IMAGE_QUALITY ,HGPDTTOOLDB_TITLE_IMAGE_QUALITY},
{HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY ,HGPDTTOOLDB_TITLE_IMAGE_QUALITY},
{HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_IMAGEING_QUALITY},
{HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_BIAS_IMAGEING_QUALITY},
{HGPDTTOOLDB_NAME_CLARITY_QUALITY ,HGPDTTOOLDB_TITLE_CLARITY_QUALITY},
@ -384,7 +384,8 @@ public:
break;
//ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &close, &closelen);//结束恢复默认
}
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0)
else if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_GRAY_QUALITY) == 0)
{
if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0)
{
@ -480,7 +481,8 @@ public:
case SANE_EVENT_IMAGE_OK:
{
if ( wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_GRAY_QUALITY) == 0
||wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_GET_DISTORTION_VAL) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SCANNING_SENSOR) == 0
|| wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY) == 0
@ -546,7 +548,9 @@ public:
test_map_[HGPDTTOOLDB_NAME_PLACE_CORRECTION_PAPER] = &test::test_place_correction_paper;
test_map_[HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD] = &test::test_auto_flat_field;
test_map_[HGPDTTOOLDB_NAME_REBOOT_DEVICE] = &test::test_reboot_device;
test_map_[HGPDTTOOLDB_NAME_IMAGE_QUALITY] = &test::test_image_quality;
test_map_[HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY] = &test::test_image_color_quality;
test_map_[HGPDTTOOLDB_NAME_IMAGE_GRAY_QUALITY] = &test::test_image_gray_quality;
test_map_[HGPDTTOOLDB_NAME_GET_DISTORTION_VAL] = &test::test_get_auto_distortion;
test_map_[HGPDTTOOLDB_NAME_SET_DISTORTION_VAL] = &test::test_set_auto_distortion;
@ -868,8 +872,8 @@ public:
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设备重启中,请观察设备是否重启", true);
return ret;
}
/* 扫描图像质量确认 */
int test_image_quality(void *data)
/* 扫描图像彩色质量确认 */
int test_image_color_quality(void *data)
{
if (!data)
{
@ -900,6 +904,47 @@ public:
{
return -1;
}
const char* color = OPTION_VALUE_YSMS_24WCS;
unsigned int colorlen = strlen(color);
helper_->io_control(IO_CTRL_CODE_SET_COLOR, (void*)color, &colorlen);
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
}
/* 扫描图像灰度质量确认 */
int test_image_gray_quality(void* data)
{
if (!data)
{
return SCANNER_ERR_DATA_DAMAGED;
}
wchar_t* p = (wchar_t*)data;
std::string str;
int ret = SCANNER_ERR_OK,
dpi = 0;
unsigned int len = sizeof(int);
size_t strl = 0;
ret = wchar_to_char(str, p, &strl);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
str.resize(strl);
ret = wchar_to_char(str, p, &strl);
if (str.empty())
{
return SCANNER_ERR_DATA_DAMAGED;
}
dpi = atoi(str.c_str());
}
if (dpi > 0)
{
ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &dpi, &len);
}
if (ret != SCANNER_ERR_OK)
{
return -1;
}
const char* color = OPTION_VALUE_YSMS_256JHD;
unsigned int colorlen = strlen(color);
helper_->io_control(IO_CTRL_CODE_SET_COLOR, (void*)color, &colorlen);
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
}
/* 获取自动计算畸变值 */

View File

@ -124,8 +124,10 @@
#define HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD L"AUTO_FLAT_FIELD"
/* 重启设备 */
#define HGPDTTOOLDB_NAME_REBOOT_DEVICE L"REBOOT_DEVICE"
/* 扫描图像质量确认 */
#define HGPDTTOOLDB_NAME_IMAGE_QUALITY L"IMAGE_QUALITY"
/* 扫描图像彩色质量确认 */
#define HGPDTTOOLDB_NAME_IMAGE_COLOR_QUALITY L"IMAGE_COLOR_QUALITY"
/* 扫描图像灰度质量确认 */
#define HGPDTTOOLDB_NAME_IMAGE_GRAY_QUALITY L"IMAGE_GRAY_QUALITY"
/* 色卡纸成像质量评估 */
#define HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY L"COLORCARD_IMAGEING_QUALITY"
/* 色卡纸偏色成像质量评估 */