|
|
@@ -951,13 +951,18 @@ void CSettingPageUI::InitControl()
|
|
|
|
|
|
//初始化AI识别的设置
|
|
|
box = static_cast<CCheckBoxUI *>(this->FindSubControl(_T("setting_is_ai_recognition_open")));
|
|
|
+ CHorizontalLayoutUI* videoLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_video_layout")));
|
|
|
if (CSetting::GetInstance()->GetParam("setting_is_ai_recognition_open") == "1")
|
|
|
{
|
|
|
box->Selected(true, false);
|
|
|
+
|
|
|
+ videoLayout->SetVisible(true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
box->Selected(false, false);
|
|
|
+
|
|
|
+ videoLayout->SetVisible(false);
|
|
|
}
|
|
|
|
|
|
//初始化展示设置
|
|
|
@@ -1607,18 +1612,20 @@ void CSettingPageUI::HandleClickMsg(TNotifyUI& msg)
|
|
|
else if (name == _T("setting_is_ai_recognition_open"))
|
|
|
{
|
|
|
CCheckBoxUI * box = static_cast<CCheckBoxUI *>(this->FindSubControl(_T("setting_is_ai_recognition_open")));
|
|
|
-
|
|
|
+ CHorizontalLayoutUI* videoLayout = static_cast<CHorizontalLayoutUI*>(this->FindSubControl(_T("setting_video_layout")));
|
|
|
if (box->IsSelected())
|
|
|
{
|
|
|
CSetting::GetInstance()->SetParam("setting_is_ai_recognition_open", "0");
|
|
|
|
|
|
CDiandanAIShibieWorker::GetInstance()->StopAIShibie();
|
|
|
+ videoLayout->SetVisible(false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CSetting::GetInstance()->SetParam("setting_is_ai_recognition_open", "1");
|
|
|
|
|
|
CDiandanAIShibieWorker::GetInstance()->StartAIShibie();
|
|
|
+ videoLayout->SetVisible(true);
|
|
|
}
|
|
|
}
|
|
|
else if (name == _T("setting_logout"))
|
|
|
@@ -3476,12 +3483,27 @@ void CSettingPageUI::HandleUpdateVideo()
|
|
|
cvtColor(img, img, cv::COLOR_GRAY2BGR);
|
|
|
}
|
|
|
|
|
|
+ CCheckBoxUI* box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_ai_recognition_open")));
|
|
|
+ if (box->IsSelected() == false)
|
|
|
+ {
|
|
|
+ //还没开启AI识别,所以界面上image控件的大小还没计算出来,等待一会再重新读取
|
|
|
+ Sleep(20);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
//缩放尺寸,适合在界面上展示,过大过小都不好看,这个尺寸是根据界面上image控件的大小来定的,可以根据实际情况调整(摄像头拍摄出来的,默认为800*600)
|
|
|
CControlUI* pImage = static_cast<CControlUI*>(this->FindSubControl(_T("image_video")));
|
|
|
RECT imageRect = pImage->GetPos();
|
|
|
int imageWidth = imageRect.right - imageRect.left;
|
|
|
int imageHeight = imageRect.bottom - imageRect.top;
|
|
|
|
|
|
+ if (imageWidth <= 0 || imageHeight <= 0)
|
|
|
+ {
|
|
|
+ //尺寸错误,等待一会再重新读取
|
|
|
+ Sleep(1000);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
cv::resize(img, img, cv::Size(imageWidth, imageHeight), 0, 0, cv::INTER_LINEAR);
|
|
|
|
|
|
// 创建或更新位图
|