畸变调整

This commit is contained in:
13038267101 2023-01-05 20:19:55 +08:00
parent 6019462e06
commit aa17d7556b
1 changed files with 23 additions and 10 deletions

View File

@ -366,13 +366,17 @@ public:
if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0 || strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_DISTORTION) == 0) if (strcmp((char*)data, STATU_DESC_SCAN_STOPPED) != 0 || strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_DISTORTION) == 0)
{ {
type = false; type = false;
is_distortion_get_image = false;
wcscpy(buf, L"畸变修正值获取失败,原因--->"); wcscpy(buf, L"畸变修正值获取失败,原因--->");
} }
else else
{ {
type = true; is_distortion_get_image = true;
wcscpy(buf, L"畸变修正值获取完成:"); //type = true;
//wcscpy(buf, L"畸变修正值获取完成:");
break;
} }
//ret = h->io_control(IO_CTRL_CODE_GET_DPI_COLOR_CHECK_VAL, &close, &closelen);//结束恢复默认 //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_QUALITY) == 0)
@ -867,25 +871,34 @@ public:
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);
helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len); ret = helper_->io_control(IO_CTRL_CODE_SET_DISTORTION_IMAGE, &type, &len);
while (1) if (ret != SCANNER_ERR_OK)
{
return ret;
}
int cnt = 0;
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, &val, &llen);
break; break;
} }
Sleep(2); else if (cnt == 10)
break;
Sleep(1000);
cnt++;
} }
if (val > 0) if (val > 0)
{ {
float f = *(float*)&val; float f = *(float*)&val;
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&f, true); helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_DISTORTION_VAL, (void *)&f, true);
} }
else //else
{ //{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false); // helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT,(void*)L"自动计算畸变值获取失败", false);
} //}
return ret; return ret;
} }
int test_set_auto_distortion(void* data) int test_set_auto_distortion(void* data)