diff --git a/README.md b/README.md index 81214ac..1b32298 100644 --- a/README.md +++ b/README.md @@ -18,20 +18,14 @@ Identify the types and quantities of smoke boxes -SmokeBoxIdentification.cpp中根据STOCK_CHECK_HEAD等关键词,选择哪个相机进行拍照。 +周三下午 -所以需要跟通讯对一下,什么信号可以说明是哪个方向的相机进行拍摄。 +2D相机模块修改:由于之前是多个相机拍一个库,若前一个相机的图像为OK,则不运行下一个;故而vecImageInfo中的值都是多个相机拍的一堆烟。 -之前是captureSide和captureTop,顶部和侧面拍摄。 +但是石家庄方案只需要一台相机拍摄即可品规。一个软件接入的多台相机是分别要执行的结果。 -相机载入的时候,读入矫正文件: ++结果绘制:调色+文字+大模板结果需要放大2倍 -m_calib->Load(strFileName.toStdString().c_str()); - - - -图片矫正: - -m_calib->FixImage(m_imgOrigin, m_imgFixed); +3D模块,先接入相机 diff --git a/runner17/Release/config/module.json b/runner17/Release/config/module.json index 6d82758..5e42bfd 100644 --- a/runner17/Release/config/module.json +++ b/runner17/Release/config/module.json @@ -3,6 +3,7 @@ "CodeScan": 0, "Sensor": 0, "Camera2D": 4, - "Camera3D": 1 + "Camera3D": 1, + "COMMRules": 1 } } diff --git a/runner17/Release/log/log-2024-01-09.log b/runner17/Release/log/log-2024-01-09.log index 206f998..e208820 100644 --- a/runner17/Release/log/log-2024-01-09.log +++ b/runner17/Release/log/log-2024-01-09.log @@ -1,44 +1,192 @@ -Info | 2024-01-09 18:47:06 ܶ | initCamera -Debug | 2024-01-09 18:47:06 ܶ | Decode smokeInfo from "D:/Code/Logistics/smokeboxidentification/runner17/Release\\user\\smokeInfo.xlsx" successed -Debug | 2024-01-09 18:47:06 ܶ | "D:/Code/Logistics/smokeboxidentification/runner17/Release\\templateNum" has not folder -Debug | 2024-01-09 18:47:06 ܶ | Find device: "00787720450" -Debug | 2024-01-09 18:47:06 ܶ | m_vecPCamera size: 1 -Warning | 2024-01-09 18:47:06 ܶ | QObject::moveToThread: Cannot move objects with a parent -Debug | 2024-01-09 18:47:06 ܶ | init CategoryMatcher successed -Debug | 2024-01-09 18:47:06 ܶ | NetControl::onConnected +Info | 2024-01-09 20:10:17 ܶ | initCamera +Debug | 2024-01-09 20:10:17 ܶ | Decode smokeInfo from "D:/Code/Logistics/smokeboxidentification/runner17/Release\\user\\smokeInfo.xlsx" successed +Debug | 2024-01-09 20:10:17 ܶ | "D:/Code/Logistics/smokeboxidentification/runner17/Release\\templateNum" has not folder +Debug | 2024-01-09 20:10:17 ܶ | Find device: "00787720450" +Debug | 2024-01-09 20:10:17 ܶ | m_vecPCamera size: 1 +Warning | 2024-01-09 20:10:17 ܶ | QObject::moveToThread: Cannot move objects with a parent +Debug | 2024-01-09 20:10:17 ܶ | init CategoryMatcher successed +Debug | 2024-01-09 20:10:18 ܶ | NetControl::onConnected TPTcpClient::slotConnected -Debug | 2024-01-09 18:47:06 ܶ | ӳɹ -Debug | 2024-01-09 18:47:08 ܶ | Open camera: "00787720450" successed -Debug | 2024-01-09 18:47:08 ܶ | Start camera: "00787720450" successed -Debug | 2024-01-09 18:47:08 ܶ | Set device successed -Debug | 2024-01-09 18:47:08 ܶ | Set camera: "00787720450" software trigger successed -Warning | 2024-01-09 18:47:10 ܶ | i receive data from server: "GP&6&111&2121&1&310102&25>" -Debug | 2024-01-09 18:47:10 ܶ | msg: "GP&6&111&2121&1&310102&25>" content: "GP&6&111&2121&1&310102&25" -Debug | 2024-01-09 18:47:10 ܶ | strlist length: 7 head: "GP" -Info | 2024-01-09 18:47:10 ܶ | [captureSide]: Enter -Info | 2024-01-09 18:47:10 ܶ | [onCapture]: Enter -Info | 2024-01-09 18:47:10 ܶ | [onCapture]: cameraLocation = 0 -Info | 2024-01-09 18:47:10 ܶ | [onCapture]: Out -Debug | 2024-01-09 18:47:10 ܶ | start capture, length: 1 -Debug | 2024-01-09 18:47:10 ܶ | convert Mat successed! -Debug | 2024-01-09 18:47:10 ܶ | ת -Info | 2024-01-09 18:47:10 ܶ | imgInfo.image.cols = 1920 -Info | 2024-01-09 18:47:10 ܶ | imgInfo.image.rows = 1200 -Info | 2024-01-09 18:47:10 ܶ | imgInfo.image.step = 1920 -Info | 2024-01-09 18:47:10 ܶ | imgInfo.imageOrigin == nullptr -Debug | 2024-01-09 18:47:10 ܶ | [Camera]: Side Camera Captured. -Debug | 2024-01-09 18:47:10 ܶ | Save image: ".\\fileData\\\\1.BMP" -Debug | 2024-01-09 18:47:10 ܶ | "Camera 00787720450 Match Start ..." -Info | 2024-01-09 18:47:10 ܶ | "Camera 00787720450 SetImageData OK!" -Critical | 2024-01-09 18:47:10 ܶ | strList.last() = "11" -Critical | 2024-01-09 18:47:10 ܶ | jieduan = "1" -Critical | 2024-01-09 18:47:10 ܶ | level = 1 -Debug | 2024-01-09 18:47:10 ܶ | Get TemplateImg OK! -Debug | 2024-01-09 18:47:10 ܶ | templateLevel = 1 -Info | 2024-01-09 18:47:10 ܶ | level = 1 -Info | 2024-01-09 18:47:10 ܶ | templateImgPath = "./templateImg/310102/310102-11.bmp" -Debug | 2024-01-09 18:47:10 ܶ | Level == 1 -Debug | 2024-01-09 18:47:11 ܶ | "Level: 1 match failed!" -Debug | 2024-01-09 18:47:44 ܶ | delete netControl -Debug | 2024-01-09 18:47:44 ܶ | NetControl::onDisconnected +Debug | 2024-01-09 20:10:18 ܶ | ӳɹ +Debug | 2024-01-09 20:10:19 ܶ | Open camera: "00787720450" successed +Debug | 2024-01-09 20:10:19 ܶ | Start camera: "00787720450" successed +Debug | 2024-01-09 20:10:19 ܶ | Set device successed +Debug | 2024-01-09 20:10:19 ܶ | Set camera: "00787720450" software trigger successed +Warning | 2024-01-09 20:10:23 ܶ | i receive data from server: "ST&6&111&2121&1>" +Debug | 2024-01-09 20:10:23 ܶ | msg: "ST&6&111&2121&1>" content: "ST&6&111&2121&1" +Debug | 2024-01-09 20:10:23 ܶ | strlist length: 5 head: "ST" +Debug | 2024-01-09 20:10:23 ܶ | ʼ̵ +Warning | 2024-01-09 20:10:30 ܶ | i receive data from server: "GP&6&111&2121&1&310102&25>" +Debug | 2024-01-09 20:10:30 ܶ | msg: "GP&6&111&2121&1&310102&25>" content: "GP&6&111&2121&1&310102&25" +Debug | 2024-01-09 20:10:30 ܶ | strlist length: 7 head: "GP" +Debug | 2024-01-09 20:10:30 ܶ | λȡͼ +Info | 2024-01-09 20:10:30 ܶ | [captureSide]: Enter +Info | 2024-01-09 20:10:30 ܶ | [onCapture]: Enter +Info | 2024-01-09 20:10:30 ܶ | [onCapture]: cameraLocation = 0 +Info | 2024-01-09 20:10:30 ܶ | [onCapture]: Out +Debug | 2024-01-09 20:10:30 ܶ | start capture, length: 1 +Debug | 2024-01-09 20:10:31 ܶ | convert Mat successed! +Debug | 2024-01-09 20:10:31 ܶ | ת +Debug | 2024-01-09 20:10:31 ܶ | [Camera]: Side Camera Captured. +Info | 2024-01-09 20:10:31 ܶ | workMode = 2 +Debug | 2024-01-09 20:10:31 ܶ | Save image: ".\\fileData\\2121\\1.BMP" +Debug | 2024-01-09 20:10:31 ܶ | "Camera 00787720450 Match Start ..." +Debug | 2024-01-09 20:10:31 ܶ | Get TemplateImg OK! +Debug | 2024-01-09 20:10:31 ܶ | templateLevel = 2 +Info | 2024-01-09 20:10:31 ܶ | level = 1 +Info | 2024-01-09 20:10:31 ܶ | templateImgPath = "./templateImg/310102/310102-11.bmp" +Debug | 2024-01-09 20:10:31 ܶ | Level == 1 +Info | 2024-01-09 20:10:31 ܶ | level = 2 +Info | 2024-01-09 20:10:31 ܶ | templateImgPath = "./templateImg/310102/310102-21.bmp" +Debug | 2024-01-09 20:10:32 ܶ | "Camera 00787720450 Match successful!" +Info | 2024-01-09 20:10:32 ܶ | fileName "1_310102_rlt.BMP" +Info | 2024-01-09 20:10:32 ܶ | filePath ".\\fileData\\2121\\1_310102_rlt.BMP" +Debug | 2024-01-09 20:10:32 ܶ | send msg: "RT&6&111&2121&1&&&0>" +Warning | 2024-01-09 20:16:35 ܶ | i receive data from server: "ST&6&111&2121&1>" +Debug | 2024-01-09 20:16:35 ܶ | msg: "ST&6&111&2121&1>" content: "ST&6&111&2121&1" +Debug | 2024-01-09 20:16:35 ܶ | strlist length: 5 head: "ST" +Debug | 2024-01-09 20:16:35 ܶ | ʼ̵ +Warning | 2024-01-09 20:16:40 ܶ | i receive data from server: "GP&6&111&2121&1&310102&25>" +Debug | 2024-01-09 20:16:40 ܶ | msg: "GP&6&111&2121&1&310102&25>" content: "GP&6&111&2121&1&310102&25" +Debug | 2024-01-09 20:16:40 ܶ | strlist length: 7 head: "GP" +Debug | 2024-01-09 20:16:40 ܶ | λȡͼ +Info | 2024-01-09 20:16:40 ܶ | [captureSide]: Enter +Info | 2024-01-09 20:16:40 ܶ | [onCapture]: Enter +Info | 2024-01-09 20:16:40 ܶ | [onCapture]: cameraLocation = 0 +Info | 2024-01-09 20:16:40 ܶ | [onCapture]: Out +Debug | 2024-01-09 20:16:40 ܶ | start capture, Debug | 2024-01-09 20:16:45 ܶ | delete netControl +Debug | 2024-01-09 20:16:45 ܶ | NetControl::onDisconnected TPTcpClient::slotDisconnected + | [Camera]: Side Camera Captured. +Info | 2024-01-09 20:16:40 ܶ | workMode = 2 +Debug | 2024-01-09 20:16:40 ܶ | Save image: ".\\fileData\\2121\\1.BMP" +Debug | 2024-01-09 20:16:40 ܶ | "Camera 00787720450 Match Start ..." +Debug | 2024-01-09 20:16:40 ܶ | Get TemplateImg OK! +Debug | 2024-01-09 20:16:40 ܶ | templateLevel = 2 +Info | 2024-01-09 20:16:40 ܶ | level = 1 +Info | 2024-01-09 20:16:40 ܶ | templateImgPath = "./templateImg/310102/310102-11.bmp" +Debug | 2024-01-09 20:16:40 ܶ | Level == 1 +Info | 2024-01-09 20:16:40 ܶ | level = 2 +Info | 2024-01-09 20:16:40 ܶ | templateImgPath = "./templateImg/310102/310102-21.bmp" +Debug | 2024-01-09 20:16:41 ܶ | "Camera 00787720450 Match successful!" +Info | 2024-01-09 20:16:41 ܶ | fileName "1_310102_rlt.BMP" +Info | 2024-01-09 20:16:41 ܶ | filePath ".\\fileData\\2121\\1_310102_rlt.BMP" +Debug | 2024-01-09 20:16:41 ܶ | send msg: "RT&6&111&2121&1&&&0>" +Debug | 2024-01-09 20:17:09 ܶ | delete netControl +Debug | 2024-01-09 20:17:09 ܶ | NetControl::onDisconnected +TPTcpClient::slotDisconnected +Info | 2024-01-09 20:18:42 ܶ | initCamera +Debug | 2024-01-09 20:18:42 ܶ | Decode smokeInfo from "D:/Code/Logistics/smokeboxidentification/runner17/Release\\user\\smokeInfo.xlsx" successed +Debug | 2024-01-09 20:18:42 ܶ | "D:/Code/Logistics/smokeboxidentification/runner17/Release\\templateNum" has not folder +Debug | 2024-01-09 20:18:42 ܶ | Find device: "00787720450" +Debug | 2024-01-09 20:18:43 ܶ | m_vecPCamera size: 1 +Warning | 2024-01-09 20:18:43 ܶ | QObject::moveToThread: Cannot move objects with a parent +Debug | 2024-01-09 20:18:43 ܶ | init CategoryMatcher successed +Debug | 2024-01-09 20:18:43 ܶ | NetControl::onConnected +TPTcpClient::slotConnected +Debug | 2024-01-09 20:18:43 ܶ | ӳɹ +Debug | 2024-01-09 20:18:44 ܶ | Open camera: "00787720450" successed +Debug | 2024-01-09 20:18:44 ܶ | Start camera: "00787720450" successed +Debug | 2024-01-09 20:18:44 ܶ | Set device successed +Debug | 2024-01-09 20:18:44 ܶ | Set camera: "00787720450" software trigger successed +Warning | 2024-01-09 20:18:53 ܶ | i receive data from server: "ST&6&111&2121&1>" +Debug | 2024-01-09 20:18:53 ܶ | msg: "ST&6&111&2121&1>" content: "ST&6&111&2121&1" +Debug | 2024-01-09 20:18:53 ܶ | strlist length: 5 head: "ST" +Debug | 2024-01-09 20:18:53 ܶ | ʼ̵ +Warning | 2024-01-09 20:18:58 ܶ | i receive data from server: "GP&6&111&2121&1&310102&25>" +Debug | 2024-01-09 20:18:58 ܶ | msg: "GP&6&111&2121&1&310102&25>" content: "GP&6&111&2121&1&310102&25" +Debug | 2024-01-09 20:18:58 ܶ | strlist length: 7 head: "GP" +Debug | 2024-01-09 20:18:58 ܶ | λȡͼ +Info | 2024-01-09 20:18:58 ܶ | [captureSide]: Enter +Info | 2024-01-09 20:18:58 ܶ | [onCapture]: Enter +Info | 2024-01-09 20:18:58 ܶ | [onCapture]: cameraLocation = 0 +Info | 2024-01-09 20:18:58 ܶ | [onCapture]: Out +Debug | 2024-01-09 20:18:58 ܶ | start capture, length: 1 +Debug | 2024-01-09 20:18:58 ܶ | convert Mat successed! +Debug | 2024-01-09 20:18:58 ܶ | ת +Debug | 2024-01-09 20:18:58 ܶ | [Camera]: Side Camera Captured. +Info | 2024-01-09 20:18:58 ܶ | workMode = 2 +Debug | 2024-01-09 20:18:58 ܶ | Save image: ".\\fileData\\2121\\1.BMP" +Debug | 2024-01-09 20:18:58 ܶ | "Camera 00787720450 Match Start ..." +Debug | 2024-01-09 20:18:58 ܶ | Get TemplateImg OK! +Debug | 2024-01-09 20:18:58 ܶ | templateLevel = 2 +Info | 2024-01-09 20:18:58 ܶ | level = 1 +Info | 2024-01-09 20:18:58 ܶ | templateImgPath = "./templateImg/310102/310102-11.bmp" +Debug | 2024-01-09 20:18:58 ܶ | Level == 1 +Info | 2024-01-09 20:18:58 ܶ | level = 2 +Info | 2024-01-09 20:18:58 ܶ | templateImgPath = "./templateImg/310102/310102-21.bmp" +Debug | 2024-01-09 20:18:59 ܶ | "Camera 00787720450 Match successful!" +Info | 2024-01-09 20:18:59 ܶ | fileName "1_310102_rlt.BMP" +Info | 2024-01-09 20:18:59 ܶ | filePath ".\\fileData\\2121\\1_310102_rlt.BMP" +Debug | 2024-01-09 20:18:59 ܶ | send msg: "RT&6&111&2121&1&&&0>" +Debug | 2024-01-09 20:20:07 ܶ | delete netControl +Debug | 2024-01-09 20:20:07 ܶ | NetControl::onDisconnected +TPTcpClient::slotDisconnected +Info | 2024-01-09 20:20:26 ܶ | initCamera +Debug | 2024-01-09 20:20:26 ܶ | Decode smokeInfo from "D:/Code/Logistics/smokeboxidentification/runner17/Release\\user\\smokeInfo.xlsx" successed +Debug | 2024-01-09 20:20:26 ܶ | "D:/Code/Logistics/smokeboxidentification/runner17/Release\\templateNum" has not folder +Debug | 2024-01-09 20:20:26 ܶ | Find device: "00787720450" +Debug | 2024-01-09 20:20:26 ܶ | m_vecPCamera size: 1 +Warning | 2024-01-09 20:20:26 ܶ | QObject::moveToThread: Cannot move objects with a parent +Debug | 2024-01-09 20:20:26 ܶ | init CategoryMatcher successed +Debug | 2024-01-09 20:20:26 ܶ | NetControl::onConnected +TPTcpClient::slotConnected +Debug | 2024-01-09 20:20:26 ܶ | ӳɹ +Debug | 2024-01-09 20:20:28 ܶ | Open camera: "00787720450" successed +Debug | 2024-01-09 20:20:28 ܶ | Start camera: "00787720450" successed +Debug | 2024-01-09 20:20:28 ܶ | Set device successed +Debug | 2024-01-09 20:20:28 ܶ | Set camera: "00787720450" software trigger successed +Warning | 2024-01-09 20:20:35 ܶ | i receive data from server: "ST&6&111&2121&1>" +Debug | 2024-01-09 20:20:35 ܶ | msg: "ST&6&111&2121&1>" content: "ST&6&111&2121&1" +Debug | 2024-01-09 20:20:35 ܶ | strlist length: 5 head: "ST" +Debug | 2024-01-09 20:20:35 ܶ | ʼ̵ +Warning | 2024-01-09 20:20:40 ܶ | i receive data from server: "GP&6&111&2121&1&310102&25>" +Debug | 2024-01-09 20:20:40 ܶ | msg: "GP&6&111&2121&1&310102&25>" content: "GP&6&111&2121&1&310102&25" +Debug | 2024-01-09 20:20:40 ܶ | strlist length: 7 head: "GP" +Debug | 2024-01-09 20:20:40 ܶ | λȡͼ +Info | 2024-01-09 20:20:40 ܶ | [captureSide]: Enter +Info | 2024-01-09 20:20:40 ܶ | [onCapture]: Enter +Info | 2024-01-09 20:20:40 ܶ | [onCapture]: cameraLocation = 0 +Info | 2024-01-09 20:20:40 ܶ | [onCapture]: Out +Debug | 2024-01-09 20:20:40 ܶ | start capture, length: 1 +Debug | 2024-01-09 20:20:40 ܶ | convert Mat successed! +Debug | 2024-01-09 20:20:40 ܶ | ת +Debug | 2024-01-09 20:20:40 ܶ | [Camera]: Side Camera Captured. +Info | 2024-01-09 20:20:40 ܶ | workMode = 2 +Debug | 2024-01-09 20:20:40 ܶ | Save image: ".\\fileData\\2121\\1.BMP" +Debug | 2024-01-09 20:20:40 ܶ | "Camera 00787720450 Match Start ..." +Debug | 2024-01-09 20:20:40 ܶ | Get TemplateImg OK! +Debug | 2024-01-09 20:20:40 ܶ | templateLevel = 2 +Info | 2024-01-09 20:20:40 ܶ | level = 1 +Info | 2024-01-09 20:20:40 ܶ | templateImgPath = "./templateImg/310102/310102-11.bmp" +Debug | 2024-01-09 20:20:40 ܶ | Level == 1 +Info | 2024-01-09 20:20:41 ܶ | level = 2 +Info | 2024-01-09 20:20:41 ܶ | templateImgPath = "./templateImg/310102/310102-21.bmp" +Debug | 2024-01-09 20:20:41 ܶ | "Camera 00787720450 Match successful!" +Info | 2024-01-09 20:20:41 ܶ | fileName "1_310102_rlt.BMP" +Info | 2024-01-09 20:20:41 ܶ | filePath ".\\fileData\\2121\\1_310102_rlt.BMP" +Warning | 2024-01-09 20:20:48 ܶ | i receive data from server: "GP&6&111&2121&1&310102&25>" +Debug | 2024-01-09 20:20:48 ܶ | msg: "GP&6&111&2121&1&310102&25>" content: "GP&6&111&2121&1&310102&25" +Debug | 2024-01-09 20:20:48 ܶ | strlist length: 7 head: "GP" +Debug | 2024-01-09 20:20:48 ܶ | λȡͼ +Info | 2024-01-09 20:20:48 ܶ | [captureSide]: Enter +Info | 2024-01-09 20:20:48 ܶ | [onCapture]: Enter +Info | 2024-01-09 20:20:48 ܶ | [onCapture]: cameraLocation = 0 +Info | 2024-01-09 20:20:48 ܶ | [onCapture]: Out +Debug | 2024-01-09 20:20:48 ܶ | start capture, length: 1 +Debug | 2024-01-09 20:20:48 ܶ | convert Mat successed! +Debug | 2024-01-09 20:20:48 ܶ | ת +Debug | 2024-01-09 20:20:48 ܶ | [Camera]: Side Camera Captured. +Info | 2024-01-09 20:20:48 ܶ | workMode = 2 +Debug | 2024-01-09 20:20:48 ܶ | Save image: ".\\fileData\\2121\\1.BMP" +Debug | 2024-01-09 20:20:48 ܶ | "Camera 00787720450 Match Start ..." +Debug | 2024-01-09 20:20:48 ܶ | Get TemplateImg OK! +Debug | 2024-01-09 20:20:48 ܶ | templateLevel = 2 +Info | 2024-01-09 20:20:48 ܶ | level = 1 +Info | 2024-01-09 20:20:48 ܶ | templateImgPath = "./templateImg/310102/310102-11.bmp" +Debug | 2024-01-09 20:20:48 ܶ | Level == 1 +Info | 2024-01-09 20:20:48 ܶ | level = 2 +Info | 2024-01-09 20:20:48 ܶ | templateImgPath = "./templateImg/310102/310102-21.bmp" +Debug | 2024-01-09 20:20:49 ܶ | "Camera 00787720450 Match successful!" +Info | 2024-01-09 20:20:49 ܶ | fileName "1_310102_rlt.BMP" +Info | 2024-01-09 20:20:49 ܶ | filePath ".\\fileData\\2121\\1_310102_rlt.BMP" diff --git a/runner17/Release/smokeBox.exe b/runner17/Release/smokeBox.exe index 5445633..1d48976 100644 Binary files a/runner17/Release/smokeBox.exe and b/runner17/Release/smokeBox.exe differ diff --git a/runner17/Release/templateImg/310102/310102-21.bmp b/runner17/Release/templateImg/310102/310102-21.bmp new file mode 100644 index 0000000..1724e2b Binary files /dev/null and b/runner17/Release/templateImg/310102/310102-21.bmp differ diff --git a/runner17/Release/templateImg/320111/320111-21.bmp b/runner17/Release/templateImg/320111/320111-21.bmp new file mode 100644 index 0000000..a827134 Binary files /dev/null and b/runner17/Release/templateImg/320111/320111-21.bmp differ diff --git a/src/CameraControl.cpp b/src/CameraControl.cpp index 9096c74..3c8212b 100644 --- a/src/CameraControl.cpp +++ b/src/CameraControl.cpp @@ -495,7 +495,8 @@ void CameraControl::capture(const QStringList& serialNumberList) imgInfo.imageOrigin = ILImagePtr(__uuidof(LImage)); imgInfo.imageFixed = ILImagePtr(__uuidof(LImage)); } - imgInfo.imageOrigin->SetImageData(imgInfo.image.cols, imgInfo.image.rows, (void*)imgInfo.image.data, imgInfo.image.step, 0); + //imgInfo.imageOrigin->SetImageData(imgInfo.image.cols, imgInfo.image.rows, (void*)imgInfo.image.data, imgInfo.image.step, 0); + imgInfo.imageOrigin->Load("C:/Users/LENOVO/Downloads/0108/310102.bmp"); if (m_calib->IsCalibrated()) { m_calib->FixImage(imgInfo.imageOrigin, imgInfo.imageFixed); diff --git a/src/CategoryMatcher.cpp b/src/CategoryMatcher.cpp index 499f8ff..84aa2f2 100644 --- a/src/CategoryMatcher.cpp +++ b/src/CategoryMatcher.cpp @@ -73,6 +73,7 @@ void CategoryMatcher::setILMatch(const MatchParam& matchParam) } + bool CategoryMatcher::smokeMatch(const QString& typeNo, ILImagePtr image) { std::pair> templateLevelAndvecMatchRltPtr; @@ -133,8 +134,6 @@ bool CategoryMatcher::smokeMatch(const QString& typeNo, const ILImagePtr ilImgPt QMap strScoreMap = templateObj.value(level); for (QMap::iterator it = strScoreMap.begin(); it != strScoreMap.end(); ++it) { - //Ҫ֤û1ģ壬2ģͼ - QString templateImgPath = it.key(); qInfo() << "templateImgPath = "<< templateImgPath; ILImagePtr ilTemplatePtr(__uuidof(LImage)); @@ -262,9 +261,6 @@ bool CategoryMatcher::getTemplateImgFileInfo(const QString& folderPath, Template QString templateImgPath = imgFileInfo.filePath(); //··ʱȡʧ int level = strList.last().mid(0, 1).toInt(); - qCritical() << "strList.last() = " << strList.last(); - qCritical() << "jieduan = " << strList.last().mid(0, 1); - qCritical() << "level = " << level; templateObject[level].insert(templateImgPath, 70); diff --git a/src/SmokeBoxIdentification.cpp b/src/SmokeBoxIdentification.cpp index 40a790b..411fee5 100644 --- a/src/SmokeBoxIdentification.cpp +++ b/src/SmokeBoxIdentification.cpp @@ -153,11 +153,11 @@ void SmokeBoxIdentification::saveImage(const cv::Mat& imgMat, const QString& fil void SmokeBoxIdentification::saveImage(const QVector& vecImageInfo, int workMode) { QString dataSaveFolderPath; + qInfo() << "workMode = " << workMode; switch (workMode) { case WorkMode::StockCheck: - dataSaveFolderPath = QString("%1\\%2\\%3").arg(FILE_STORAGE_PATH).arg(m_currtStockCheckInfo.stockNum) - .arg(m_currtStockCheckInfo.taskNum); + dataSaveFolderPath = QString("%1\\%2").arg(FILE_STORAGE_PATH).arg(m_currtStockCheckInfo.taskNum); break; case WorkMode::IntoStock: dataSaveFolderPath =QString("%1\\%2\\%3\\%4").arg(FILE_STORAGE_PATH).arg(INTOSTOCK_IMAGE_FOLDER) @@ -165,7 +165,6 @@ void SmokeBoxIdentification::saveImage(const QVector& vecImageInfo, i break; default: dataSaveFolderPath = QString("%1\\%2").arg(FILE_STORAGE_PATH).arg(m_currtIntoStockInfo.taskNum); - //qDebug() << "Mode: " << workMode << "do not save Image"; //return; } QDir folder(dataSaveFolderPath); @@ -209,7 +208,7 @@ Q_SLOT void SmokeBoxIdentification::onCapturedImage(const QVector& ve { sendResults(MsgType::DataCollectionEndSC); } - else if (m_workMode = WorkMode::IntoStock) + else if (m_workMode == WorkMode::IntoStock) { sendResults(MsgType::IntoStockResult); } @@ -234,6 +233,7 @@ Q_SLOT void SmokeBoxIdentification::onCapturedImage(const QVector& ve QString dataSaveFolder = QString("%1\\%2").arg(FILE_STORAGE_PATH) .arg(m_currtStockCheckInfo.taskNum); + // ֮ǰǶһ⣬ǰһͼΪOKһ for each (const ImageInfo& imgInfo in vecImageInfo) { QString str = QString("Camera %1 Match Start ...").arg(imgInfo.cameraSn); @@ -255,12 +255,33 @@ Q_SLOT void SmokeBoxIdentification::onCapturedImage(const QVector& ve m_pCategoryMatcher->saveResultsImage(filePath); break; } + else + { + str = QString("Camera %1 Match Failed!").arg(imgInfo.cameraSn); + qWarning() << str; + } + } else { qDebug() << "imgInfo.image is Empty!"; } } + if (!bRlt) + { + QString filePath = dataSaveFolder + QString("\\%1_error.PNG") + .arg(m_currtStockCheckInfo.smokeTypeNum); + m_pCategoryMatcher->saveResultsImage(filePath); + //saveImage(imgRltMat, filePath); + } + QString typeNumRlt = bRlt ? typeNum : "0"; + m_currtStockCheckInfo.smokeTypeNumRlt = typeNumRlt; + qDebug() << "typeNumRlt: " << typeNumRlt; + + //Ƚ3DҪ3DٷȷϢ + m_currtStockCheckInfo.smokeQuantityRlt = typeNumRlt; + sendResults(MsgType::StockCheckResult); + //emit sgCategoryMatchFinished(typeNumRlt); }); #elif IMAGEDRAWING==OPENCV @@ -405,16 +426,26 @@ Q_SLOT void SmokeBoxIdentification::onDecodeMsg(const QString& msg) } } } + else if (strList.at(0) == START_TAKE) + { + qDebug() << "ʼ̵"; + //m_workMode = WorkMode::IntoStock; + m_currtIntoStockInfo.streetName = strList.at(1); + m_currtIntoStockInfo.id = strList.at(2); + m_currtIntoStockInfo.taskNum = strList.at(3); + m_currtIntoStockInfo.stockLocation = strList.at(4); + + } else if (strList.at(0) == START_CAPTURE) { - StockCheckInfo stockCheckInfo; - stockCheckInfo.streetName = strList.at(1); - stockCheckInfo.id = strList.at(2); - stockCheckInfo.taskNum = strList.at(3); - stockCheckInfo.stockLocation = strList.at(4); - stockCheckInfo.smokeTypeNum = strList.at(5); - stockCheckInfo.smokeQuantity = strList.at(6); - m_currtStockCheckInfo = stockCheckInfo; + qDebug() << "λȡͼ"; + //m_workMode = WorkMode::StockCheck; + m_currtStockCheckInfo.streetName = strList.at(1); + m_currtStockCheckInfo.id = strList.at(2); + m_currtStockCheckInfo.taskNum = strList.at(3); + m_currtStockCheckInfo.stockLocation = strList.at(4); + m_currtStockCheckInfo.smokeTypeNum = strList.at(5); + m_currtStockCheckInfo.smokeQuantity = strList.at(6); captureSide(); } } @@ -496,31 +527,49 @@ void SmokeBoxIdentification::sendResults(int mode) .append(SPLIT_RULE).append(m_currtStockCheckInfo.taskNum).append(END_SYMBOL); break; case StockCheckResult: - if (QString::compare(m_currtStockCheckInfo.smokeTypeNum, m_currtStockCheckInfo.smokeTypeNumRlt)<0 - && QString::compare("0", m_currtStockCheckInfo.smokeTypeNumRlt) < 0) - { - resultInfoMsg.append(STOCK_CHECK_HEAD).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.streetName).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.stockNum).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.taskNum).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE) - .append(QString::number(0)).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE) - .append(QString::number(0)).append(SPLIT_RULE) - .append(QString::number(0)).append(END_SYMBOL); - } - else + switch (m_moduleParam.COMMRules) { - resultInfoMsg.append(STOCK_CHECK_HEAD).append(SPLIT_RULE) + case eCommunicationRules::emNJ: + if (QString::compare(m_currtStockCheckInfo.smokeTypeNum, m_currtStockCheckInfo.smokeTypeNumRlt) < 0 + && QString::compare("0", m_currtStockCheckInfo.smokeTypeNumRlt) < 0) + { + resultInfoMsg.append(STOCK_CHECK_HEAD).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.streetName).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.stockNum).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.taskNum).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE) + .append(QString::number(0)).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE) + .append(QString::number(0)).append(SPLIT_RULE) + .append(QString::number(0)).append(END_SYMBOL); + } + else + { + resultInfoMsg.append(STOCK_CHECK_HEAD).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.streetName).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.stockNum).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.taskNum).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.smokeTypeNum).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.smokeQuantity).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.smokeQuantityRlt).append(SPLIT_RULE) + .append(QString::number(m_currtStockCheckInfo.correctness)).append(END_SYMBOL); + } + break; + case eCommunicationRules::emSJZ: + resultInfoMsg.append(RETURN_MES).append(SPLIT_RULE) .append(m_currtStockCheckInfo.streetName).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.stockNum).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.id).append(SPLIT_RULE) .append(m_currtStockCheckInfo.taskNum).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.smokeTypeNum).append(SPLIT_RULE) - .append(m_currtStockCheckInfo.smokeQuantity).append(SPLIT_RULE) + .append(m_currtStockCheckInfo.stockLocation).append(SPLIT_RULE) .append(m_currtStockCheckInfo.smokeTypeNumRlt).append(SPLIT_RULE) .append(m_currtStockCheckInfo.smokeQuantityRlt).append(SPLIT_RULE) .append(QString::number(m_currtStockCheckInfo.correctness)).append(END_SYMBOL); + break; + default: + break; } + break; case IntoStockResult: { @@ -785,6 +834,7 @@ void SmokeBoxIdentification::moduleLoading() m_moduleParam.Sensor = ModuleParamObj.value("Sensor").toInt(); m_moduleParam.Camera2D = ModuleParamObj.value("Camera2D").toInt(); m_moduleParam.Camera3D = ModuleParamObj.value("Camera3D").toInt(); + m_moduleParam.COMMRules = (eCommunicationRules)ModuleParamObj.value("COMMRules").toInt(); } //// ıļԶȡģʽ diff --git a/src/SmokeBoxIdentification.h b/src/SmokeBoxIdentification.h index 5ac64f5..e23be84 100644 --- a/src/SmokeBoxIdentification.h +++ b/src/SmokeBoxIdentification.h @@ -22,9 +22,6 @@ #include "ui_SmokeBoxIdentification.h" -//#define IMAGEDRAWING OPENCV -#define IMAGEDRAWING LPV - enum MsgType { @@ -52,9 +49,11 @@ enum StockCheckMode struct IntoStockInfo { - QString streetName; - QString taskNum; - QString stockNum; + QString streetName; // + QString taskNum; // - + QString stockNum; //λUL062015020111 6ŶѶ2ұߣ + QString id = 0; + QString stockLocation = 0; // 12ң0Ϊ֮ǰ QStringList imagesPathList; }; @@ -121,12 +120,14 @@ struct ModuleParam int Sensor; // 0Ϊװ int Camera2D; // 2D int Camera3D; // 3D + eCommunicationRules COMMRules; // ͨѶ ModuleParam() { CodeScan = 1; Sensor = 1; Camera2D = 2; Camera3D = 2; + COMMRules = eCommunicationRules::emNJ; } }; diff --git a/src/common/commonDefine.h b/src/common/commonDefine.h index b898a4a..c566934 100644 --- a/src/common/commonDefine.h +++ b/src/common/commonDefine.h @@ -23,6 +23,9 @@ #define DELETE_POINTER(p) if (p) {delete p; p = NULL;} +//#define IMAGEDRAWING OPENCV +#define IMAGEDRAWING LPV + #define MODULE_CONFIG "\\config\\module.json" #define CAMERA_CONFIG "\\config\\camera.json" #define NET_CONFIG "\\config\\netSetting.json" @@ -48,7 +51,9 @@ #define CODE_CONTENT_SPLIT "," #define CONTENT_SPLIT ";" #define END_SYMBOL ">" -#define START_CAPTURE "GP" +#define START_CAPTURE "GP" // λȡͼ +#define START_TAKE "ST" // ʼ̵ +#define RETURN_MES "RT" // #define LP_COLOR_CONTROL 0x88 #define LP_D1TOD80 0x86 @@ -127,6 +132,12 @@ struct debugMsg QString msAD_2; }; +enum eCommunicationRules +{ + emNJ = 0, // Ͼ + emSJZ // ʯׯ +}; + enum eCameraLocation { emSide=0, // Чɼ diff --git a/tpvs17/SmokeBoxIdentification/fileData/intoStock/1.BMP b/tpvs17/SmokeBoxIdentification/fileData/intoStock/1.BMP deleted file mode 100644 index 65e4449..0000000 Binary files a/tpvs17/SmokeBoxIdentification/fileData/intoStock/1.BMP and /dev/null differ