diff --git a/src/main/java/org/myrobotlab/service/OakD.java b/src/main/java/org/myrobotlab/service/OakD.java index ca644df229..2dd580507c 100644 --- a/src/main/java/org/myrobotlab/service/OakD.java +++ b/src/main/java/org/myrobotlab/service/OakD.java @@ -19,8 +19,7 @@ /** * - * https://github.com/luxonis/depthai - * python3 depthai_demo.py -cb callbacks.py + * https://github.com/luxonis/depthai python3 depthai_demo.py -cb callbacks.py * * https://github.com/luxonis/depthai-experiments/tree/master/gen2-face-recognition * @@ -69,6 +68,7 @@ public void installDepthAi() { // git.clone("./", config.depthaiCloneUrl) List packages = new ArrayList<>(); + packages.add("depthai_sdk==1.15.1"); packages.add("depthai==2.29.0"); packages.add("blobconverter==1.4.3"); packages.add("opencv-python"); @@ -79,19 +79,19 @@ public void installDepthAi() { } // py4j.exec(""); } - + public void startRecognition() { - + } - + public void stopRecognition() { - + } - + /** - * FIXME - turn into interface - * Will publish processing messages to the processor(s) currently - * subscribed. + * FIXME - turn into interface Will publish processing messages to the + * processor(s) currently subscribed. + * * @param method * @param data */ @@ -102,9 +102,8 @@ public void processMessage(String method, Object data) { } /** - * FIXME - turn into interface - * Processing publishing point, where everything InMoov2 wants to be processed - * is turned into a message and published. + * FIXME - turn into interface Processing publishing point, where everything + * InMoov2 wants to be processed is turned into a message and published. * * @param msg * @return @@ -113,7 +112,6 @@ public Message publishProcessMessage(Message msg) { return msg; } - public Classification publishClassification(Classification classification) { classification.src = getName(); // we have a detection or recognition event ... publish the associated image @@ -122,19 +120,19 @@ public Classification publishClassification(Classification classification) { // imageToWeb("classification.png"); invoke("imageToWeb", "classification.png"); } - + return classification; } - + public String imageToWeb(String filePath) { byte[] content = null; try (FileInputStream fileInputStream = new FileInputStream(new File(filePath))) { - content = new byte[(int) new File(filePath).length()]; - fileInputStream.read(content); - String img = Base64.getEncoder().encodeToString(content); - return String.format("data:image/png;base64,%s", img); + content = new byte[(int) new File(filePath).length()]; + fileInputStream.read(content); + String img = Base64.getEncoder().encodeToString(content); + return String.format("data:image/png;base64,%s", img); } catch (IOException e) { - error(e); + error(e); } return null; }