diff --git a/libs/3d/3ddll.dll b/libs/3d/3ddll.dll
new file mode 100644
index 0000000..a3601a5
Binary files /dev/null and b/libs/3d/3ddll.dll differ
diff --git a/libs/3d/BoxTopCalculation.dll b/libs/3d/BoxTopCalculation.dll
new file mode 100644
index 0000000..000bda6
Binary files /dev/null and b/libs/3d/BoxTopCalculation.dll differ
diff --git a/libs/3d/ConsoleApplication1.exe b/libs/3d/ConsoleApplication1.exe
new file mode 100644
index 0000000..7f37e44
Binary files /dev/null and b/libs/3d/ConsoleApplication1.exe differ
diff --git a/libs/3d/OpenNI2.dll b/libs/3d/OpenNI2.dll
new file mode 100644
index 0000000..0a39c4e
Binary files /dev/null and b/libs/3d/OpenNI2.dll differ
diff --git a/libs/3d/cameraapi1.dll b/libs/3d/cameraapi1.dll
new file mode 100644
index 0000000..7063797
Binary files /dev/null and b/libs/3d/cameraapi1.dll differ
diff --git a/libs/3d/opencv_world3416.dll b/libs/3d/opencv_world3416.dll
new file mode 100644
index 0000000..dd96802
Binary files /dev/null and b/libs/3d/opencv_world3416.dll differ
diff --git a/libs/3d/pcl_common.dll b/libs/3d/pcl_common.dll
new file mode 100644
index 0000000..cbf938f
Binary files /dev/null and b/libs/3d/pcl_common.dll differ
diff --git a/libs/3d/pcl_filters.dll b/libs/3d/pcl_filters.dll
new file mode 100644
index 0000000..5366a37
Binary files /dev/null and b/libs/3d/pcl_filters.dll differ
diff --git a/libs/3d/pcl_io.dll b/libs/3d/pcl_io.dll
new file mode 100644
index 0000000..2ae6804
Binary files /dev/null and b/libs/3d/pcl_io.dll differ
diff --git a/libs/3d/pcl_io_ply.dll b/libs/3d/pcl_io_ply.dll
new file mode 100644
index 0000000..63b8ef6
Binary files /dev/null and b/libs/3d/pcl_io_ply.dll differ
diff --git a/libs/3d/pcl_kdtree.dll b/libs/3d/pcl_kdtree.dll
new file mode 100644
index 0000000..d53de0d
Binary files /dev/null and b/libs/3d/pcl_kdtree.dll differ
diff --git a/libs/3d/pcl_octree.dll b/libs/3d/pcl_octree.dll
new file mode 100644
index 0000000..e3320eb
Binary files /dev/null and b/libs/3d/pcl_octree.dll differ
diff --git a/libs/3d/pcl_sample_consensus.dll b/libs/3d/pcl_sample_consensus.dll
new file mode 100644
index 0000000..51eac5d
Binary files /dev/null and b/libs/3d/pcl_sample_consensus.dll differ
diff --git a/libs/3d/pcl_search.dll b/libs/3d/pcl_search.dll
new file mode 100644
index 0000000..24ea77c
Binary files /dev/null and b/libs/3d/pcl_search.dll differ
diff --git a/libs/3d/vtkCommonCore-8.2.dll b/libs/3d/vtkCommonCore-8.2.dll
new file mode 100644
index 0000000..cd41b1e
Binary files /dev/null and b/libs/3d/vtkCommonCore-8.2.dll differ
diff --git a/libs/3d/vtksys-8.2.dll b/libs/3d/vtksys-8.2.dll
new file mode 100644
index 0000000..ac39d48
Binary files /dev/null and b/libs/3d/vtksys-8.2.dll differ
diff --git a/libs/lx/LxCameraApi.dll b/libs/lx/LxCameraApi.dll
new file mode 100644
index 0000000..f3599e6
Binary files /dev/null and b/libs/lx/LxCameraApi.dll differ
diff --git a/libs/lx/LxDataProcess.dll b/libs/lx/LxDataProcess.dll
new file mode 100644
index 0000000..5222376
Binary files /dev/null and b/libs/lx/LxDataProcess.dll differ
diff --git a/libs/opencv_java480.dll b/libs/opencv_java480.dll
new file mode 100644
index 0000000..42f7a47
Binary files /dev/null and b/libs/opencv_java480.dll differ
diff --git a/web/pom.xml b/web/pom.xml
index f4a7149..94cead1 100644
--- a/web/pom.xml
+++ b/web/pom.xml
@@ -19,6 +19,7 @@
+
com.zhehekeji
common
@@ -107,6 +108,19 @@
system
${project.basedir}/src/main/resources/libs/rxtx-2.1.7.jar
+
+
+
+
+
+
+
+
+ com.fazecast
+ jSerialComm
+ 2.9.2
+
+
diff --git a/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java b/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java
index facc777..0f3d9fa 100644
--- a/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java
+++ b/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java
@@ -5,6 +5,8 @@ import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
+import java.util.List;
+
@Component
@ConfigurationProperties
@Data
@@ -20,6 +22,8 @@ public class ConfigProperties {
*/
public static Integer JOYWARE_CAMERA = 0;
+ private String ComConfig;
+
private CameraConfig cameraConfig;
private VideoStyleConfig videoStyleConfig;
@@ -51,6 +55,21 @@ public class ConfigProperties {
private Rfid rfid;
private IntelliBink intelliBink;
+
+ private String siteInventoryIp;
+ private String localIp;
+ private List template;
+
+ @Data
+ public static class Template {
+
+ private String name;
+
+ private String code;
+ private Integer id;
+
+ }
+
@Data
public static class IntelliBink {
@@ -90,9 +109,11 @@ public class ConfigProperties {
public Integer verticalAdjustmentTime = 2;
- private String industrialCamera;
+ private List industrialCamera;
private String camera3D;
+ private String sickIp;
+ private Integer sickPort;
}
@Data
@@ -105,6 +126,9 @@ public class ConfigProperties {
public static class SavePath{
private String mediaPath;
private String mp4Path;
+ private String croppingPath;
+ private String winePreparationPath;
+ private String netPicPath;
}
@Data
diff --git a/web/src/main/java/com/zhehekeji/web/config/FusionDesignApplication.java b/web/src/main/java/com/zhehekeji/web/config/FusionDesignApplication.java
new file mode 100644
index 0000000..68b486f
--- /dev/null
+++ b/web/src/main/java/com/zhehekeji/web/config/FusionDesignApplication.java
@@ -0,0 +1,27 @@
+package com.zhehekeji.web.config;
+
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.Resource;
+import java.time.Duration;
+
+@EnableAsync
+@EnableScheduling
+@Configuration
+public class FusionDesignApplication {
+ @Resource
+ //RestTemplateBuilder
+ private RestTemplateBuilder builder;
+ // 使用RestTemplateBuilder来实例化RestTemplate对象,spring默认已经注入了RestTemplateBuilder实例
+ @Bean
+ public RestTemplate restTemplate() {
+ return builder.setConnectTimeout(Duration.ofSeconds(20)) // 设置连接超时时间,单位毫秒
+ .setReadTimeout(Duration.ofSeconds(20)) // 设置读取超时时间,单位毫秒
+ .build();
+ }
+}
diff --git a/web/src/main/java/com/zhehekeji/web/controller/CameraControlController.java b/web/src/main/java/com/zhehekeji/web/controller/CameraControlController.java
index 8a8f4b7..520738f 100644
--- a/web/src/main/java/com/zhehekeji/web/controller/CameraControlController.java
+++ b/web/src/main/java/com/zhehekeji/web/controller/CameraControlController.java
@@ -41,14 +41,14 @@ public class CameraControlController {
checkLogin(id);
return Result.success();
}
-
- private NetSDKLib.LLong cameraLogin(Integer cameraId){
- log.info("相机登录 cameraId:{}",cameraId);
- Camera camera = cameraMapper.selectById(cameraId);
- Assert.notNull(camera,"球机不存在");
- NetSDKLib.LLong lLong = loginControlModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword());
- return lLong;
- }
+//
+// private NetSDKLib.LLong cameraLogin(Integer cameraId){
+// log.info("相机登录 cameraId:{}",cameraId);
+// Camera camera = cameraMapper.selectById(cameraId);
+// Assert.notNull(camera,"球机不存在");
+// NetSDKLib.LLong lLong = loginControlModule.login(camera.getIp(),camera.getPort(),camera.getUser(),camera.getPassword());
+// return lLong;
+// }
@PostMapping("/up/{id}")
@ApiOperation(value = "球机控制向上")
diff --git a/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java b/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java
index 68021aa..4849c0e 100644
--- a/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java
+++ b/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java
@@ -2,11 +2,13 @@ package com.zhehekeji.web.controller;
import com.zhehekeji.core.pojo.Result;
import com.zhehekeji.web.config.ConfigProperties;
+import com.zhehekeji.web.entity.KuKou;
import com.zhehekeji.web.entity.Street;
import com.zhehekeji.web.pojo.IndustrialCameraVO;
import com.zhehekeji.web.pojo.stock.CheckLogSearch;
import com.zhehekeji.web.service.IndustrialCamera.HikSaveImage;
import com.zhehekeji.web.service.IndustrialCamera.LxPointCloudSaveImage;
+import com.zhehekeji.web.service.KuKouService;
import com.zhehekeji.web.service.PlcService;
import com.zhehekeji.web.service.StreetService;
import com.zhehekeji.web.service.algorithm.FeatureMatchingExample;
@@ -14,22 +16,24 @@ import com.zhehekeji.web.service.algorithm.InventoryService;
import com.zhehekeji.web.service.algorithm.PcdPojo;
import com.zhehekeji.web.service.algorithm.PointCloudProcessor;
import com.zhehekeji.web.service.client.TransmissionPojo;
+import com.zhehekeji.web.service.com.SerialPortExample;
+import com.zhehekeji.web.service.sick.SickSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
import java.util.UUID;
import static com.zhehekeji.web.service.algorithm.FeatureMatchingExample.base642Mat;
@@ -51,31 +55,151 @@ public class IndustrialCameraController {
@Resource
ConfigProperties configProperties;
+ @Resource
+ SerialPortExample serialPortExample;
+
+ @Resource
+ KuKouService kuKouService;
+
@ApiOperation("拍照")
@PostMapping("pic")
- public Result pic(@RequestBody CheckLogSearch checkLogSearch){
- Street street = streetService.streetById(checkLogSearch.getStreetId());
+ public Result> pic(){
+ List list = new ArrayList<>();
+
+ LocalDate currentDate = LocalDate.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+ if(configProperties.getCameraConfig().getIndustrialCamera()!=null) {
+ for (String camera:configProperties.getCameraConfig().getIndustrialCamera()) {
+
+ String path = "industrialCamera/" +currentDate.format(formatter)+"/"+camera+ UUID.randomUUID() + ".jpeg";
+ hikSaveImage.saveImage(camera, configProperties.getSavePath().getMediaPath() + path, "sn");
+ list.add(path);
+ }
+ return new Result<>(list);
+ }else {
+ return new Result<>(list);
+ }
+ }
+
+ @ApiOperation("拍照")
+ @PostMapping("pic3D")
+ public Result> pic3D(){
+ List list = new ArrayList<>();
+
+ LocalDate currentDate = LocalDate.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+ if(configProperties.getCameraConfig().getIndustrialCamera()!=null) {
+ String path = "industrialCamera/" +currentDate.format(formatter)+"/"+configProperties.getCameraConfig().getCamera3D()+ UUID.randomUUID() + ".pcd";
+ LxPointCloudSaveImage.saveImage(configProperties.getCameraConfig().getCamera3D(), path,1);
+ list.add(path);
+ return new Result<>(list);
+ }else {
+ return new Result<>(list);
+ }
+ }
+
+
+
+ @ApiOperation("拍照")
+ @GetMapping("task")
+ public Result> task(int i){
+ List list = new ArrayList<>();
+ String path = "task/"+i+"箱" +"/";
+
+ if(configProperties.getCameraConfig().getIndustrialCamera()!=null) {
+
+ LxPointCloudSaveImage.saveImage(configProperties.getCameraConfig().getCamera3D(), path+configProperties.getCameraConfig().getCamera3D() + ".pcd",1);
+
+ }else {
+
+ }
+
if(configProperties.getCameraConfig().getIndustrialCamera()!=null) {
- String path = "industrialCamera/" + UUID.randomUUID() + ".jpeg";
- hikSaveImage.saveImage(configProperties.getCameraConfig().getIndustrialCamera(), configProperties.getSavePath().getMediaPath() + path, "sn");
- return new Result<>(path);
+ for (String camera:configProperties.getCameraConfig().getIndustrialCamera()) {
+
+ //String path = "industrialCamera/" +currentDate.format(formatter)+"/"+camera+ UUID.randomUUID() + ".jpeg";
+ hikSaveImage.saveImage(camera, configProperties.getSavePath().getMediaPath() + path+camera + ".jpeg", "sn");
+ list.add(path);
+ }
+
}else {
- return new Result<>("");
+
+ }
+ return new Result<>();
+ }
+
+ @ApiOperation("打开光源")
+ @GetMapping("openLight")
+ public Result openLight(int i){
+ serialPortExample.openLight(i);
+
+ return new Result<>("");
+ }
+
+
+ @ApiOperation("站点盘点")
+ @PostMapping("siteInventory")
+ public Result siteInventory(@RequestBody IndustrialCameraVO industrialCameraVo){
+ serialPortExample.openLight(1);
+ //2d图片保存
+ Result> listResult = pic();
+ boolean re = false;
+ //sick识别
+ String code = SickSocket.readOCR(configProperties.getCameraConfig().getSickIp(), configProperties.getCameraConfig().getSickPort());
+ //2d识别
+ if (listResult.getData().size()!=0){
+ re = FeatureMatchingExample.matchTemplate(
+ InventoryService.readImagesInFolder(configProperties.getSavePath().getMediaPath() + "template/" + industrialCameraVo.getTypeMacth()),
+ configProperties.getSavePath().getMediaPath() +listResult.getData().get(0));
}
+ //3d pcd保存
+ LocalDate currentDate = LocalDate.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+
+ String pathPcd = configProperties.getSavePath().getMediaPath()
+ +"camera3D/"
+ +currentDate.format(formatter)+"/" +UUID.randomUUID()+"-";
+ int count = inventoryService.match3D(industrialCameraVo.getTypeMacth(),pathPcd+"-"+configProperties.getCameraConfig().getCamera3D()+".pcd","");
+ //3d识别
+ //保存信息
+ KuKou kuKou = new KuKou();
+ kuKou.setCreateTime(LocalDateTime.now());
+ if (re) {
+ kuKou.setFlag(1);
+ kuKou.setCategoryName(industrialCameraVo.getTypeMacthName());
+ }
+ kuKou.setCount(count);
+ kuKou.setCode(code);
+ kuKou.setPath(configProperties.getSavePath().getNetPicPath()+listResult.getData().get(0));
+ kuKouService.save(kuKou);
+ serialPortExample.openLight(0);
+ return new Result<>(kuKou);
}
@ApiOperation("识别")
@PostMapping("Macth")
public Result Macth(@RequestBody IndustrialCameraVO industrialCameraVo){
- String srcImg = configProperties.getSavePath().getMediaPath() + industrialCameraVo.getPicImg();
- String srcImgRest = configProperties.getSavePath().getMediaPath() + industrialCameraVo.getPicImg();
+ LocalDate currentDate = LocalDate.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ String camera= configProperties.getCameraConfig().getIndustrialCamera().get(0);
+
+
+ String path = "industrialCamera/" + currentDate.format(formatter) + "/" + camera + UUID.randomUUID() + ".jpeg";
+ hikSaveImage.saveImage(camera, configProperties.getSavePath().getMediaPath() + path, "sn");
+
+
+
+ String srcImg = configProperties.getSavePath().getMediaPath() + path;
//识别结果
boolean re = FeatureMatchingExample.matchTemplate(
InventoryService.readImagesInFolder(configProperties.getSavePath().getMediaPath() + "template/" + industrialCameraVo.getTypeMacth()),
srcImg);
if (re){
- return new Result<>(industrialCameraVo.getPicImg()+".jpg");
+ return new Result<>(srcImg+".jpg");
}else {
return new Result<>("");
@@ -92,74 +216,10 @@ public class IndustrialCameraController {
String pathPcd = configProperties.getSavePath().getMediaPath()
+"camera3D/"
+currentDate.format(formatter)+"/" +UUID.randomUUID()+"-";
- Integer count = inventoryService.match3D(industrialCameraVo.getName(),pathPcd+"-"+configProperties.getCameraConfig().getCamera3D()+".pcd");
+ int count = inventoryService.match3D(industrialCameraVo.getTypeMacth(),pathPcd+"-"+configProperties.getCameraConfig().getCamera3D()+".pcd","");
return Result.success(count);
}
@Resource
InventoryService inventoryService;
-//
-// @ApiOperation("匹配所有")
-// @PostMapping("matchFeatures")
-// public Boolean matchFeatures(@RequestBody TransmissionPojo transmissionPojo) {
-// //return true;
-//
-// return null;
-// }
-
-//
-// @ApiOperation("随行")
-// @PostMapping("actionType")
-// public void action(@RequestBody TransmissionPojo transmissionPojo) {
-//
-// Street street = streetService.getStreetByPlcId(transmissionPojo.getStreetNumber());
-//
-//
-// //随行地址
-// String pcdPath1 =configProperties.getSavePath().getMediaPath() + street.getLeft3D()+"\\000\\"
-// +transmissionPojo.getRow()+"-"+transmissionPojo.getColumn()+"-"+transmissionPojo.getDirection()+"-L"+".pcd";
-//
-// String pcdPath2 =configProperties.getSavePath().getMediaPath() + street.getRight3D()+"\\000\\"
-// +transmissionPojo.getRow()+"-"+transmissionPojo.getColumn()+"-"+transmissionPojo.getDirection()+"-R"+".pcd";
-// //拍照
-// System.out.println(street.getLeft3D()+" 111211 "+ pcdPath1);
-// LxPointCloudSaveImage lxPointCloudSaveImage = new LxPointCloudSaveImage();
-// lxPointCloudSaveImage.saveImage(street.getLeft3D(), pcdPath1,1);
-//
-// LxPointCloudSaveImage lxPointCloudSaveImage1 = new LxPointCloudSaveImage();
-// lxPointCloudSaveImage1.saveImage(street.getRight3D(), pcdPath2,2);
-// }
-// @ApiOperation("模板建立")
-// @PostMapping("MacthCreate")
-// public Result MacthCreate(@RequestBody IndustrialCameraVO industrialCameraVo){
-// Path folder = Paths.get(configProperties.getSavePath().getMediaPath()+"template/"+industrialCameraVo.getTypeMacth());
-// try {
-// Files.walkFileTree(folder, new SimpleFileVisitor() {
-// @Override
-// public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-// Files.delete(file);
-// return FileVisitResult.CONTINUE;
-// }
-//
-// @Override
-// public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
-// Files.delete(dir);
-// return FileVisitResult.CONTINUE;
-// }
-// });
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-// for (int i = 0; i < industrialCameraVo.getFileList().size(); i++){
-// try {
-// Mat template = base642Mat(industrialCameraVo.getFileList().get(i).getThumbUrl()
-// .replace("data:image/jpeg;base64,","").replace("data:image/png;base64,",""));
-//
-// Imgcodecs.imwrite(configProperties.getSavePath().getMediaPath()+"template/"+industrialCameraVo.getTypeMacth()+"/"+i+".jpg", template);
-// } catch (IOException e) {
-// throw new RuntimeException(e);
-// }
-// }
-// return new Result<>(true);
-// }
}
diff --git a/web/src/main/java/com/zhehekeji/web/controller/KuKouController.java b/web/src/main/java/com/zhehekeji/web/controller/KuKouController.java
index 55a658c..f2e53a0 100644
--- a/web/src/main/java/com/zhehekeji/web/controller/KuKouController.java
+++ b/web/src/main/java/com/zhehekeji/web/controller/KuKouController.java
@@ -9,10 +9,7 @@ import com.zhehekeji.web.service.KuKouService;
import com.zhehekeji.web.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -34,7 +31,7 @@ public class KuKouController {
return Result.success(kuKouService.pageInfo(orderSearch));
}
- @PostMapping("/latest")
+ @GetMapping("/latest")
@ApiOperation(value = "最新数据")
//@SessionHandler
public Result latest() {
diff --git a/web/src/main/java/com/zhehekeji/web/entity/Interval3D.java b/web/src/main/java/com/zhehekeji/web/entity/Interval3D.java
new file mode 100644
index 0000000..f99c575
--- /dev/null
+++ b/web/src/main/java/com/zhehekeji/web/entity/Interval3D.java
@@ -0,0 +1,90 @@
+package com.zhehekeji.web.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class Interval3D {
+ private int storey;
+ private double maxX;
+ private double minX;
+ private double maxZ;
+ private double minZ;
+ private double maxY;
+ private double minY;
+ private Interval3D z;
+ private List list;
+
+ public static void main(String[] args) {
+// Interval3D interval3D = new Interval3D();
+// interval3D.maxX = 2d;
+// interval3D.minX = 2d;
+// interval3D.maxY = 2d;
+// interval3D.minY = 2d;
+// interval3D.maxZ = 2d;
+// interval3D.minZ = 2d;
+// List