3d个数解决
parent
ec77871c28
commit
82e048e56e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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<Interval3D> 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<Map<List<Interval3D>,List<Interval3D>>> list1= new ArrayList<>();
|
||||||
|
// List<Interval3D> listZ= new ArrayList<>();
|
||||||
|
// listZ.add(interval3D);
|
||||||
|
// List<Interval3D> listXY= new ArrayList<>();
|
||||||
|
// listXY.add(interval3D);
|
||||||
|
// listXY.add(interval3D);
|
||||||
|
// list1.add(Map.of(listZ,listXY));
|
||||||
|
// ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
// try {
|
||||||
|
// String formattedJson = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(list1);
|
||||||
|
// System.out.println(formattedJson);
|
||||||
|
// } catch (JsonProcessingException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
String jsonString = "\n" +
|
||||||
|
"[ {\n" +
|
||||||
|
" \"z\":{\"maxZ\":2.0, \"minZ\":2.0} ,\n" +
|
||||||
|
" \"list\": [ {\n" +
|
||||||
|
" \"maxX\" : 2.0,\n" +
|
||||||
|
" \"minX\" : 2.0,\n" +
|
||||||
|
" \"maxY\" : 2.0,\n" +
|
||||||
|
" \"minY\" : 2.0\n" +
|
||||||
|
" }, {\n" +
|
||||||
|
" \"maxX\" : 2.0,\n" +
|
||||||
|
" \"minX\" : 2.0,\n" +
|
||||||
|
" \"maxY\" : 2.0,\n" +
|
||||||
|
" \"minY\" : 2.0\n" +
|
||||||
|
" } ]\n" +
|
||||||
|
"} ,{\n" +
|
||||||
|
" \"z\":{\"maxZ\":2.0, \"minZ\":2.0} ,\n" +
|
||||||
|
" \"list\": [ {\n" +
|
||||||
|
" \"maxX\" : 2.0,\n" +
|
||||||
|
" \"minX\" : 2.0,\n" +
|
||||||
|
" \"maxY\" : 2.0,\n" +
|
||||||
|
" \"minY\" : 2.0\n" +
|
||||||
|
" }, {\n" +
|
||||||
|
" \"maxX\" : 2.0,\n" +
|
||||||
|
" \"minX\" : 2.0,\n" +
|
||||||
|
" \"maxY\" : 2.0,\n" +
|
||||||
|
" \"minY\" : 2.0\n" +
|
||||||
|
" } ]\n" +
|
||||||
|
"} ]";
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 将 JSON 字符串转换为 List<Person>
|
||||||
|
List<Interval3D> persons = objectMapper.readValue(jsonString, objectMapper.getTypeFactory().constructCollectionType(List.class, Interval3D.class));
|
||||||
|
|
||||||
|
// 打印结果
|
||||||
|
for (Interval3D person : persons) {
|
||||||
|
System.out.println(person);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.zhehekeji.web.service.algorithm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AreaUtil {
|
||||||
|
/**
|
||||||
|
* 使用鞋带公式计算多边形的面积。
|
||||||
|
* @param points 多边形顶点坐标列表
|
||||||
|
* @return 多边形的面积
|
||||||
|
*/
|
||||||
|
public static double calculatePolygonArea(List<double[]> points) {
|
||||||
|
int numPoints = points.size();
|
||||||
|
if (numPoints < 3) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double area = 0.0;
|
||||||
|
for (int i = 0; i < numPoints; i++) {
|
||||||
|
double[] current = points.get(i);
|
||||||
|
double[] next = points.get((i + 1) % numPoints); // 将最后一个点与第一个点相连
|
||||||
|
area += current[0] * next[1];
|
||||||
|
area -= next[0] * current[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.abs(area) / 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算多边形的面积
|
||||||
|
public static double calculateArea(double[][] points) {
|
||||||
|
double area = 0.0;
|
||||||
|
int n = points.length;
|
||||||
|
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
int j = (i + 1) % n; // 下一个点,循环回到起点
|
||||||
|
area += points[i][0] * points[j][1];
|
||||||
|
area -= points[j][0] * points[i][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.abs(area) / 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 示例点(自交多边形的点)
|
||||||
|
double[][] points = {
|
||||||
|
{0, 0}, // 点 0
|
||||||
|
{4, 0}, // 点 1
|
||||||
|
{2, 2}, // 点 2
|
||||||
|
{4, 4}, // 点 3
|
||||||
|
{4, 0}, // 点 1
|
||||||
|
{0, 4}, // 点 4
|
||||||
|
{-1, -1} // 点 4
|
||||||
|
};
|
||||||
|
|
||||||
|
double area = calculateArea(points);
|
||||||
|
System.out.println("Self-intersecting polygon area: " + area);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@
|
|||||||
|
package com.zhehekeji.web.service.com;
|
||||||
|
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 蚂蚁舞
|
||||||
|
*/
|
||||||
|
public class SerialPortCallback {
|
||||||
|
|
||||||
|
public void dataAvailable() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
//throw new Exception();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,137 @@
|
|||||||
|
package com.zhehekeji.web.service.com;
|
||||||
|
import com.fazecast.jSerialComm.SerialPort;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SerialPortExample {
|
||||||
|
|
||||||
|
|
||||||
|
byte[] close= {(byte) 0xCA, 0x01 ,0x00 ,0x14 ,0x14 , (byte) 0xEB, (byte) 0x87, (byte) 0x85,0x00 ,0x00 ,0x00 ,0x02 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 };
|
||||||
|
|
||||||
|
|
||||||
|
byte[] open = {(byte) 0xCA, 0x01 ,0x00 ,0x14 ,0x14 , (byte) 0xEB, (byte) 0x86, (byte) 0x85,0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 };
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//SerialPortExample example = new SerialPortExample();
|
||||||
|
//example.sendData(da);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int SERIAL_BAUD_RATE = 115200;
|
||||||
|
|
||||||
|
public static volatile boolean SERIAL_PORT_STATE = false;
|
||||||
|
|
||||||
|
public static volatile SerialPort SERIAL_PORT_OBJECT = null;
|
||||||
|
|
||||||
|
|
||||||
|
public void openLight(int i){
|
||||||
|
if(i==1) {
|
||||||
|
SerialPortManager.sendSerialPortData(open);
|
||||||
|
}else {
|
||||||
|
SerialPortManager.sendSerialPortData(close);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//查找所有可用端口
|
||||||
|
public static List<String> getSerialPortList() {
|
||||||
|
// 获得当前所有可用串口
|
||||||
|
SerialPort[] serialPorts = SerialPort.getCommPorts();
|
||||||
|
List<String> portNameList = new ArrayList<String>();
|
||||||
|
// 将可用串口名添加到List并返回该List
|
||||||
|
for(SerialPort serialPort:serialPorts) {
|
||||||
|
System.out.println(serialPort.getSystemPortName());
|
||||||
|
portNameList.add(serialPort.getSystemPortName());
|
||||||
|
}
|
||||||
|
//去重
|
||||||
|
portNameList = portNameList.stream().distinct().collect(Collectors.toList());
|
||||||
|
return portNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 连接串口
|
||||||
|
public static void connectSerialPort(String portName){
|
||||||
|
try {
|
||||||
|
SerialPort serialPort = SerialPortManager.openSerialPort(portName, SERIAL_BAUD_RATE);
|
||||||
|
TimeUnit.MILLISECONDS.sleep(2000);
|
||||||
|
//给当前串口对象设置监听器
|
||||||
|
serialPort.addDataListener(new SerialPortListener(new SerialPortCallback()));
|
||||||
|
if(serialPort.isOpen()) {
|
||||||
|
SERIAL_PORT_OBJECT = serialPort;
|
||||||
|
SERIAL_PORT_STATE = true;
|
||||||
|
System.out.println(portName+"-- start success");
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打开串口
|
||||||
|
public static SerialPort openSerialPort(String portName, Integer baudRate) {
|
||||||
|
SerialPort serialPort = SerialPort.getCommPort(portName);
|
||||||
|
if (baudRate != null) {
|
||||||
|
serialPort.setBaudRate(baudRate);
|
||||||
|
}
|
||||||
|
if (!serialPort.isOpen()) { //开启串口
|
||||||
|
serialPort.openPort(1000);
|
||||||
|
}else{
|
||||||
|
return serialPort;
|
||||||
|
}
|
||||||
|
serialPort.setFlowControl(SerialPort.FLOW_CONTROL_DISABLED);
|
||||||
|
serialPort.setComPortParameters(baudRate, 8, SerialPort.ONE_STOP_BIT, SerialPort.NO_PARITY);
|
||||||
|
serialPort.setComPortTimeouts(SerialPort.TIMEOUT_READ_BLOCKING | SerialPort.TIMEOUT_WRITE_BLOCKING, 1000, 1000);
|
||||||
|
return serialPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭串口
|
||||||
|
public static void closeSerialPort() {
|
||||||
|
if (SERIAL_PORT_OBJECT != null && SERIAL_PORT_OBJECT.isOpen()){
|
||||||
|
SERIAL_PORT_OBJECT.closePort();
|
||||||
|
SERIAL_PORT_STATE = false;
|
||||||
|
SERIAL_PORT_OBJECT = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送字节数组
|
||||||
|
public static void sendSerialPortData(byte[] content) {
|
||||||
|
if (SERIAL_PORT_OBJECT != null && SERIAL_PORT_OBJECT.isOpen()){
|
||||||
|
SERIAL_PORT_OBJECT.writeBytes(content, content.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取字节数组
|
||||||
|
public static byte[] readSerialPortData() {
|
||||||
|
if (SERIAL_PORT_OBJECT != null && SERIAL_PORT_OBJECT.isOpen()){
|
||||||
|
byte[] reslutData = null;
|
||||||
|
try {
|
||||||
|
if (!SERIAL_PORT_OBJECT.isOpen()){return null;};
|
||||||
|
int i=0;
|
||||||
|
while (SERIAL_PORT_OBJECT.bytesAvailable() > 0 && i++ < 5) Thread.sleep(20);
|
||||||
|
byte[] readBuffer = new byte[SERIAL_PORT_OBJECT.bytesAvailable()];
|
||||||
|
int numRead = SERIAL_PORT_OBJECT.readBytes(readBuffer, readBuffer.length);
|
||||||
|
if (numRead > 0) {
|
||||||
|
reslutData = readBuffer;
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return reslutData;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.zhehekeji.web.service.com;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fazecast.jSerialComm.SerialPort;
|
||||||
|
import com.fazecast.jSerialComm.SerialPortDataListener;
|
||||||
|
import com.fazecast.jSerialComm.SerialPortEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 蚂蚁舞
|
||||||
|
*/
|
||||||
|
public class SerialPortListener implements SerialPortDataListener {
|
||||||
|
|
||||||
|
private final SerialPortCallback serialPortCallback;
|
||||||
|
|
||||||
|
public SerialPortListener(SerialPortCallback serialPortCallback) {
|
||||||
|
this.serialPortCallback = serialPortCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getListeningEvents() { //必须是return这个才会开启串口工具的监听
|
||||||
|
return SerialPort.LISTENING_EVENT_DATA_AVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialEvent(SerialPortEvent serialPortEvent) {
|
||||||
|
if (serialPortCallback != null) {
|
||||||
|
serialPortCallback.dataAvailable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
package com.zhehekeji.web.service.com;
|
||||||
|
import com.fazecast.jSerialComm.SerialPort;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 蚂蚁舞
|
||||||
|
*/
|
||||||
|
public class SerialPortManager {
|
||||||
|
|
||||||
|
public static final int SERIAL_BAUD_RATE = 115200;
|
||||||
|
|
||||||
|
public static volatile boolean SERIAL_PORT_STATE = false;
|
||||||
|
|
||||||
|
public static volatile SerialPort SERIAL_PORT_OBJECT = null;
|
||||||
|
|
||||||
|
//查找所有可用端口
|
||||||
|
public static List<String> getSerialPortList() {
|
||||||
|
// 获得当前所有可用串口
|
||||||
|
SerialPort[] serialPorts = SerialPort.getCommPorts();
|
||||||
|
List<String> portNameList = new ArrayList<String>();
|
||||||
|
// 将可用串口名添加到List并返回该List
|
||||||
|
for(SerialPort serialPort:serialPorts) {
|
||||||
|
System.out.println(serialPort.getSystemPortName());
|
||||||
|
portNameList.add(serialPort.getSystemPortName());
|
||||||
|
}
|
||||||
|
//去重
|
||||||
|
portNameList = portNameList.stream().distinct().collect(Collectors.toList());
|
||||||
|
return portNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 连接串口
|
||||||
|
public static void connectSerialPort(String portName){
|
||||||
|
try {
|
||||||
|
SerialPort serialPort = SerialPortManager.openSerialPort(portName, SERIAL_BAUD_RATE);
|
||||||
|
TimeUnit.MILLISECONDS.sleep(2000);
|
||||||
|
//给当前串口对象设置监听器
|
||||||
|
serialPort.addDataListener(new SerialPortListener(new SerialPortCallback()));
|
||||||
|
if(serialPort.isOpen()) {
|
||||||
|
SERIAL_PORT_OBJECT = serialPort;
|
||||||
|
SERIAL_PORT_STATE = true;
|
||||||
|
System.out.println(portName+"-- start success");
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打开串口
|
||||||
|
public static SerialPort openSerialPort(String portName, Integer baudRate) {
|
||||||
|
SerialPort serialPort = SerialPort.getCommPort(portName);
|
||||||
|
if (baudRate != null) {
|
||||||
|
serialPort.setBaudRate(baudRate);
|
||||||
|
}
|
||||||
|
if (!serialPort.isOpen()) { //开启串口
|
||||||
|
serialPort.openPort(1000);
|
||||||
|
}else{
|
||||||
|
return serialPort;
|
||||||
|
}
|
||||||
|
serialPort.setFlowControl(SerialPort.FLOW_CONTROL_DISABLED);
|
||||||
|
serialPort.setComPortParameters(baudRate, 8, SerialPort.ONE_STOP_BIT, SerialPort.NO_PARITY);
|
||||||
|
serialPort.setComPortTimeouts(SerialPort.TIMEOUT_READ_BLOCKING | SerialPort.TIMEOUT_WRITE_BLOCKING, 1000, 1000);
|
||||||
|
return serialPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭串口
|
||||||
|
public static void closeSerialPort() {
|
||||||
|
if (SERIAL_PORT_OBJECT != null && SERIAL_PORT_OBJECT.isOpen()){
|
||||||
|
SERIAL_PORT_OBJECT.closePort();
|
||||||
|
SERIAL_PORT_STATE = false;
|
||||||
|
SERIAL_PORT_OBJECT = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送字节数组
|
||||||
|
public static void sendSerialPortData(byte[] content) {
|
||||||
|
if (SERIAL_PORT_OBJECT != null && SERIAL_PORT_OBJECT.isOpen()){
|
||||||
|
SERIAL_PORT_OBJECT.writeBytes(content, content.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取字节数组
|
||||||
|
public static byte[] readSerialPortData() {
|
||||||
|
if (SERIAL_PORT_OBJECT != null && SERIAL_PORT_OBJECT.isOpen()){
|
||||||
|
byte[] reslutData = null;
|
||||||
|
try {
|
||||||
|
if (!SERIAL_PORT_OBJECT.isOpen()){return null;};
|
||||||
|
int i=0;
|
||||||
|
while (SERIAL_PORT_OBJECT.bytesAvailable() > 0 && i++ < 5) Thread.sleep(20);
|
||||||
|
byte[] readBuffer = new byte[SERIAL_PORT_OBJECT.bytesAvailable()];
|
||||||
|
int numRead = SERIAL_PORT_OBJECT.readBytes(readBuffer, readBuffer.length);
|
||||||
|
if (numRead > 0) {
|
||||||
|
reslutData = readBuffer;
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return reslutData;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.zhehekeji.web.service.visualQuantity;
|
||||||
|
|
||||||
|
import com.sun.jna.Library;
|
||||||
|
|
||||||
|
public interface VisualQuantityCameraApi extends Library {
|
||||||
|
int cameraapi(String cloudPath, String paramPath, int typeCode);
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.zhehekeji.web.service.visualQuantity;
|
||||||
|
|
||||||
|
import com.sun.jna.Native;
|
||||||
|
import com.zhehekeji.web.service.IndustrialCamera.DcLibrary;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.zhehekeji.web.service.algorithm.PointCloudProcessor.findPcdFiles;
|
||||||
|
|
||||||
|
public class test {
|
||||||
|
|
||||||
|
|
||||||
|
static VisualQuantityCameraApi INSTANCER = (VisualQuantityCameraApi) Native.loadLibrary((System.getProperty("user.dir"))+"\\libs\\3d\\3ddll.dll", VisualQuantityCameraApi.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
String directoryPath = "E:\\泸州\\task国窖\\task"; // 替换为实际路径
|
||||||
|
File directory = new File(directoryPath);
|
||||||
|
|
||||||
|
if (!directory.exists() || !directory.isDirectory()) {
|
||||||
|
System.out.println("指定路径不是一个有效的目录!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Integer,String> map = new HashMap<>();
|
||||||
|
findPcdFiles(directory,map);
|
||||||
|
for (Integer count : map.keySet()) {
|
||||||
|
System.out.print(count +" ");
|
||||||
|
try {
|
||||||
|
Files.copy(Paths.get(map.get(count)), Paths.get("E:\\192.168.40.11.pcd"), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(1111);
|
||||||
|
int i = INSTANCER.cameraapi("E:\\192.168.40.11.pcd","E:\\2.json",3);
|
||||||
|
System.out.println(i);
|
||||||
|
// System.out.println(similarity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue