调整畸变和图像质量
This commit is contained in:
parent
fc660c7a7e
commit
aa44b8d03c
|
@ -872,27 +872,46 @@ public:
|
||||||
/* 扫描图像质量确认 */
|
/* 扫描图像质量确认 */
|
||||||
int test_image_quality(void *data)
|
int test_image_quality(void *data)
|
||||||
{
|
{
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
return SCANNER_ERR_DATA_DAMAGED;
|
||||||
|
}
|
||||||
|
unsigned int len = 0;
|
||||||
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, data, &len);
|
||||||
|
if (ret != SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
return helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
||||||
}
|
}
|
||||||
/* 获取自动计算畸变值 */
|
/* 获取自动计算畸变值 */
|
||||||
int test_get_auto_distortion(void *data)
|
int test_get_auto_distortion(void *data)
|
||||||
{
|
{
|
||||||
|
if (!data )
|
||||||
|
{
|
||||||
|
return SCANNER_ERR_DATA_DAMAGED;
|
||||||
|
}
|
||||||
int ret = SCANNER_ERR_OK,
|
int ret = SCANNER_ERR_OK,
|
||||||
val = 0;
|
val = 0;
|
||||||
SANE_Bool type = true;
|
SANE_Bool type = true;
|
||||||
unsigned int len = sizeof(SANE_Bool),
|
unsigned int len = sizeof(SANE_Bool),
|
||||||
llen = sizeof(int);
|
llen = sizeof(int);
|
||||||
|
ret = helper_->io_control(IO_CTRL_CODE_SET_DPI, &data, &len);
|
||||||
|
|
||||||
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
|
ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
|
||||||
if (ret != SCANNER_ERR_OK)
|
if (ret != SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
SANE_DISTORTION_VAL dis;
|
||||||
while (ret == SCANNER_ERR_OK)
|
while (ret == SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
if (is_distortion_get_image )
|
if (is_distortion_get_image )
|
||||||
{
|
{
|
||||||
ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_CHECK_VAL, &val, &llen);
|
ret = helper_->io_control(IO_CTRL_CODE_GET_DISTORTION_CHECK_VAL, &dis, &llen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (cnt == 10)
|
else if (cnt == 10)
|
||||||
|
@ -903,10 +922,9 @@ public:
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
if (val > 0)
|
if (dis.h > 0)
|
||||||
{
|
{
|
||||||
float f = *(float*)&val;
|
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&dis, true);
|
||||||
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&f, true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue