This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import cv2 | |
import numpy as np | |
import depthai as dai | |
from datetime import timedelta | |
def getMesh(calibData, camSocket, ispSize): | |
M1 = np.array(calibData.getCameraIntrinsics(camSocket, ispSize[0], ispSize[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import cv2 | |
import numpy as np | |
import depthai as dai | |
from datetime import timedelta | |
def getMesh(calibData, camSocket, ispSize): | |
M1 = np.array(calibData.getCameraIntrinsics(camSocket, ispSize[0], ispSize[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import depthai as dai | |
import cv2 | |
import numpy as np | |
from imread_from_url import imread_from_url | |
def add_host_depth(pipeline): | |
monoLeftNode = pipeline.create(dai.node.XLinkIn) | |
monoRightNode = pipeline.create(dai.node.XLinkIn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Run in the terminal | |
# - Build: | |
# ``` | |
# docker build . -t depthai-builder -f depthai-android.Dockerfile | |
# ``` | |
# - Create and Copy the prebuilt libraries into the host computer | |
# ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import onnx_graphsurgeon as gs | |
import numpy as np | |
import onnx | |
@gs.Graph.register() | |
def replace_input(self, new_inputs, old_input_name): | |
tensors = self.tensors() | |
# Create concat node to combine the new inputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import onnx_graphsurgeon as gs | |
import numpy as np | |
import onnx | |
left_rect_img = gs.Variable(name="left_rect", dtype=np.float32, shape=(1, 3, 240, 320)) | |
right_rect_img = gs.Variable(name="right_rect", dtype=np.float32, shape=(1, 3, 240, 320)) | |
concat_img = gs.Variable(name="concat_img", dtype=np.float32, shape=(1, 6, 240, 320)) | |
concat_node = gs.Node(op="Concat", attrs={"axis": 1}, inputs=[left_rect_img, right_rect_img], outputs=[concat_img]) | |
graph = gs.Graph(nodes=[concat_node], inputs=[left_rect_img, right_rect_img], outputs=[concat_img]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import onnx | |
import numpy as np | |
import onnx_graphsurgeon as gs | |
def split_model(onnx_model, input_names, output_names): | |
graph = gs.import_onnx(onnx_model) | |
tensors = graph.tensors() | |
graph.inputs = [tensors[input_name] for input_name in input_names] | |
graph.outputs = [tensors[output_name] for output_name in output_names] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tempfile import mkstemp | |
from shutil import move, copymode | |
from os import fdopen, remove | |
import os | |
import re | |
def has_old_style(file_path): | |
pattern = "CODE=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tempfile import mkstemp | |
from shutil import move, copymode | |
from os import fdopen, remove | |
import os | |
# Ref: https://github.com/luxonis/depthai-python/blob/main/src/pipeline/PipelineBindings.cpp | |
pattern_replacement = { "createXLinkIn()" : "create(dai.node.XLinkIn)", | |
"createXLinkOut()" : "create(dai.node.XLinkOut)", | |
"createNeuralNetwork()" : "create(dai.node.NeuralNetwork)", | |
"createColorCamera()" : "create(dai.node.ColorCamera)", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tempfile import mkstemp | |
from shutil import move, copymode | |
from os import fdopen, remove | |
import os | |
# Ref: https://github.com/luxonis/depthai-python/blob/main/src/pipeline/PipelineBindings.cpp | |
pattern_replacement = { "create(dai.node.XLinkIn)" : "createXLinkIn()", | |
"create(dai.node.XLinkOut)" : "createXLinkOut()", | |
"create(dai.node.NeuralNetwork)" : "createNeuralNetwork()", | |
"create(dai.node.ColorCamera)" : "createColorCamera()", |
NewerOlder