张洋 преди 1 месец
родител
ревизия
92becebf01

BIN
bin/Win32/Debug/zhipuzi_pos_windows/ai/yolo26s-cls-zhipuzi-448.onnx


+ 1 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/aixuexi_page.xml

@@ -28,6 +28,7 @@
 					<HorizontalLayout height="50" padding="0,20,0,0">
 						<Control></Control>
 							<Button name="aixuexi_page_paishe_btn" width="150" height="50" text="拍摄并学习" textcolor="#FFFFFFFF" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
+							<Button name="aixuexi_page_test_btn" width="150" height="50" padding="15,0,0,0" text="AI识别测试" textcolor="#FFFFFFFF" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
 						<Control></Control>
 					</HorizontalLayout>
 

BIN
bin/Win32/Release/zhipuzi_pos_windows/ai/yolo26s-cls-zhipuzi-448.onnx


BIN
res/ai/yolo26s-cls-zhipuzi-448.onnx


+ 6 - 0
zhipuzi_pos_windows/page/CAIxuexiPageUI.cpp

@@ -15,6 +15,8 @@
 
 #include "../control/CFoodXuexiImageItemUI.h"
 
+#include "../worker/CDiandanAIShibieWorker.h"
+
 CAIxuexiPageUI::CAIxuexiPageUI()
 {
 	m_hBitmap = NULL;
@@ -359,6 +361,10 @@ void CAIxuexiPageUI::HandleClickMsg(TNotifyUI& msg)
 	{
 		this->DoXuexi();
 	}
+	else if (name == L"aixuexi_page_test_btn")
+	{
+		CDiandanAIShibieWorker::GetInstance()->AddAIShibieTask();
+	}
 	else if (name == L"aixuexi_page_food_image_delete")
 	{
 		CFoodXuexiImageItemUI* m_pImageItem = static_cast<CFoodXuexiImageItemUI*>(msg.pSender->GetParent());

BIN
zhipuzi_pos_windows/resource/skin.zip


+ 2 - 2
zhipuzi_pos_windows/worker/CChengzhongWorker.cpp

@@ -307,7 +307,7 @@ void CChengzhongWorker::UpdateShow(std::string new_weight)
 			if (atof(new_weight.c_str()) > atof(m_weight.c_str()) && atof(new_weight.c_str()) > 0.01)
 			{
 				//说明目前是从稳定变为不稳定,并且重量在增加(代表放东西到秤上),并且当前重量大于10g,那么这里可以发起AI识别
-				CDiandanAIShibieWorker::GetInstance()->AddAIShibieTask();
+				//CDiandanAIShibieWorker::GetInstance()->AddAIShibieTask();
 			}
 		}
 
@@ -324,7 +324,7 @@ void CChengzhongWorker::UpdateShow(std::string new_weight)
 			if (atof(new_weight.c_str()) < 0.01)
 			{
 				//说明马上要从不稳定变为稳定了,并且重量小于10g,那么这里可以发起AI识别清空
-				CDiandanAIShibieWorker::GetInstance()->ClearAIShibieFoodname();
+				//CDiandanAIShibieWorker::GetInstance()->ClearAIShibieFoodname();
 			}
 		}
 

+ 18 - 0
zhipuzi_pos_windows/worker/CVideoCaptureWorker.cpp

@@ -88,6 +88,24 @@ void CVideoCaptureWorker::HandleVideoCapture()
     std::cout << "设置的分辨率: " << width << " x " << height << std::endl;
     std::cout << "实际分辨率: " << actualWidth << " x " << actualHeight << std::endl;
 
+	//CLewaimaiLog::OutputMessageBoxFormat(L"摄像头分辨率设置为: %d x %d\n实际分辨率: %.0f x %.0f", width, height, actualWidth, actualHeight);
+
+	// ========== 关键硬件参数:解决反光过曝发白 ==========
+	// 1. 关闭自动曝光(必须,否则强光自动提亮加重发白)
+	cap.set(cv::CAP_PROP_AUTO_EXPOSURE, 0);
+	// 2. 手动降低曝光值,数值越小进光越少,根据相机微调
+	cap.set(cv::CAP_PROP_EXPOSURE, -5);
+	// 3. 降低增益ISO,减少高光噪点饱和
+	//cap.set(cv::CAP_PROP_GAIN, 1);
+	// 4. 提高对比度,拉开明暗层次
+	//cap.set(cv::CAP_PROP_CONTRAST, 70);
+	// 5. 关闭自动白平衡,防止反光泛白
+	//cap.set(cv::CAP_PROP_AUTO_WB, 0);
+	// 手动色温,调低减少冷白反光
+	//cap.set(cv::CAP_PROP_WB_TEMPERATURE, 3300);
+	// 降低饱和度,高光不易一片惨白
+	//cap.set(cv::CAP_PROP_SATURATION, 40);
+
     while (m_is_work == true)
     {
         // 读取摄像头帧