Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions apps/default-app/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import cv2
import depthai as dai
from depthai_nodes.node import ApplyColormap
from depthai_nodes.node import ApplyDepthColormap
from typing import Optional
from utils.arguments import initialize_argparser

Expand All @@ -10,7 +10,6 @@
visualizer = dai.RemoteConnection(httpPort=8082)
device = dai.Device(dai.DeviceInfo(args.device)) if args.device else dai.Device()

STEREO_RESOLUTION = (800, 600)
NN_DIMENSIONS = (512, 288)

if not device.setIrLaserDotProjectorIntensity(1):
Expand Down Expand Up @@ -73,11 +72,22 @@
right=right_cam.requestFullResolutionOutput(dai.ImgFrame.Type.NV12),
presetMode=dai.node.StereoDepth.PresetMode.DEFAULT,
)
stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)
if platform == dai.Platform.RVC2:
stereo.setOutputSize(*STEREO_RESOLUTION)

coloredDepth = pipeline.create(ApplyColormap).build(stereo.disparity)
# RVC4 does not support stereo.setDepthAlign, ImageAlign node used instead
if platform == dai.Platform.RVC4:
cam_out = cameraNode.requestOutput(
(640, 480), type=dai.ImgFrame.Type.NV12, enableUndistortion=True
)
align = pipeline.create(dai.node.ImageAlign)
stereo.depth.link(align.input)
cam_out.link(align.inputAlignTo)
coloredDepth = pipeline.create(ApplyDepthColormap).build(
align.outputAligned
)
else:
stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)
stereo.setOutputSize(800, 600)
coloredDepth = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
coloredDepth.setColormap(cv2.COLORMAP_JET)
visualizer.addTopic("Depth", coloredDepth.out)

Expand Down
4 changes: 2 additions & 2 deletions apps/default-app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
depthai==3.0.0
depthai-nodes==0.3.4
depthai==3.4.0
depthai-nodes==0.4.0
opencv-python-headless==4.10.0.84
numpy>=1.22
5 changes: 2 additions & 3 deletions apps/p2p-measurement/backend/src/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import depthai as dai
from depthai_nodes.node import ApplyColormap
from depthai_nodes.node import ApplyDepthColormap
import numpy as np
import cv2

Expand Down Expand Up @@ -58,9 +58,8 @@
stereo.depth.link(align.input)
cam_out.link(align.inputAlignTo)

coloredDepth = pipeline.create(ApplyColormap).build(align.outputAligned)
coloredDepth = pipeline.create(ApplyDepthColormap).build(align.outputAligned)
coloredDepth.setColormap(cv2.COLORMAP_JET)
coloredDepth.setDepthPreset()

point_tracker = pipeline.create(
PointTracker, frame_width=FRAME_WIDTH, frame_height=FRAME_HEIGHT
Expand Down
5 changes: 2 additions & 3 deletions apps/p2p-measurement/backend/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
depthai==3.2.1
#depthai-nodes==0.3.7
depthai-nodes @ git+https://github.com/luxonis/depthai-nodes.git@c0f382fbe6514b62b8e98b6b805e5023c9c9438c # depth visualization in ApplyColormap
depthai==3.3.0
depthai-nodes==0.4.0
opencv-contrib-python==4.12.0.88
numpy>=1.22
4 changes: 2 additions & 2 deletions depth-measurement/calc-spatial-on-host/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import depthai as dai
from utils.roi_control import ROIControl
from utils.arguments import initialize_argparser
from depthai_nodes.node import ApplyColormap
from depthai_nodes.node import ApplyDepthColormap
from utils.measure_distance import MeasureDistance


Expand All @@ -28,7 +28,7 @@
monoLeft, monoRight, presetMode=dai.node.StereoDepth.PresetMode.DEFAULT
)

depth_color_transform = pipeline.create(ApplyColormap).build(stereo.disparity)
depth_color_transform = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
depth_color_transform.setColormap(cv2.COLORMAP_JET)

measure_distance = pipeline.create(MeasureDistance).build(
Expand Down
9 changes: 9 additions & 0 deletions depth-measurement/calc-spatial-on-host/oakapp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ prepare_build_container = []
build_steps = []

entrypoint = ["bash", "-c", "python3 -u /app/main.py"]

[base_image]
api_url = "https://registry-1.docker.io"
service = "registry.docker.io"
oauth_url = "https://auth.docker.io/token"
auth_type = "repository"
auth_name = "luxonis/oakapp-base"
image_name = "luxonis/oakapp-base"
image_tag = "1.2.6"
4 changes: 2 additions & 2 deletions depth-measurement/calc-spatial-on-host/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
depthai==3.0.0
depthai-nodes==0.3.4
depthai==3.4.0
depthai-nodes==0.4.0
opencv-python-headless==4.10.0.84
numpy>=1.22
4 changes: 2 additions & 2 deletions depth-measurement/stereo-runtime-configuration/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cv2
import depthai as dai
from depthai_nodes.node import ApplyColormap
from depthai_nodes.node import ApplyDepthColormap
from utils.arguments import initialize_argparser
from utils.stereo_config_controller import StereoConfigController

Expand Down Expand Up @@ -36,7 +36,7 @@
stereo_controller = pipeline.create(StereoConfigController).build(preview=preview)
stereo_controller.out_cfg.link(stereo.inputConfig)

depth_color = pipeline.create(ApplyColormap).build(arr=stereo.disparity)
depth_color = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
depth_color.setColormap(cv2.COLORMAP_JET)

sync = pipeline.create(dai.node.Sync)
Expand Down
9 changes: 9 additions & 0 deletions depth-measurement/stereo-runtime-configuration/oakapp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ prepare_build_container = []
build_steps = []

entrypoint = ["bash", "-c", "python3 -u /app/main.py"]

[base_image]
api_url = "https://registry-1.docker.io"
service = "registry.docker.io"
oauth_url = "https://auth.docker.io/token"
auth_type = "repository"
auth_name = "luxonis/oakapp-base"
image_name = "luxonis/oakapp-base"
image_tag = "1.2.6"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
depthai==3.0.0
depthai-nodes==0.3.4
opencv-python-headless~=4.10.0
depthai==3.4.0
depthai-nodes==0.4.0
opencv-python-headless~=4.10.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cv2
import depthai as dai
from depthai_nodes.node import ApplyColormap, ParsingNeuralNetwork
from depthai_nodes.node import ApplyColormap, ApplyDepthColormap, ParsingNeuralNetwork
from utils.arguments import initialize_argparser

_, args = initialize_argparser()
Expand Down Expand Up @@ -87,12 +88,16 @@
demux.outputs["right"].link(nn.inputs["right"])

# color stereo disparity
disparity_coloring = pipeline.create(ApplyColormap).build(stereo.disparity)
disparity_coloring.setColormap(15) # cv2.COLORMAP_PLASMA
disparity_coloring = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
disparity_coloring.setColormap(cv2.COLORMAP_PLASMA)

# color nn output
nn_coloring = pipeline.create(ApplyColormap).build(nn.out)
nn_coloring.setColormap(cv2.COLORMAP_PLASMA)

# visualization
visualizer.addTopic("Stereo Disparity", disparity_coloring.out)
visualizer.addTopic("NN", nn.out)
visualizer.addTopic("NN", nn_coloring.out)

print("Pipeline created.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ build_steps = []

depthai_models = { yaml_path = "./depthai_models" }

entrypoint = ["bash", "-c", "python3 -u /app/main.py"]
entrypoint = ["bash", "-c", "python3 -u /app/main.py"]

[base_image]
api_url = "https://registry-1.docker.io"
service = "registry.docker.io"
oauth_url = "https://auth.docker.io/token"
auth_type = "repository"
auth_name = "luxonis/oakapp-base"
image_name = "luxonis/oakapp-base"
image_tag = "1.2.5"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
depthai==3.0.0
depthai-nodes==0.3.4
depthai==3.4.0
depthai-nodes==0.4.0
opencv-python-headless~=4.10.0
numpy>=1.22
13 changes: 6 additions & 7 deletions tutorials/camera-stereo-depth/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import depthai as dai
from utils.arguments import initialize_argparser
from depthai_nodes.node import ApplyColormap
from depthai_nodes.node import ApplyDepthColormap
import cv2

_, args = initialize_argparser()
Expand All @@ -23,11 +23,11 @@
color_output = color.requestOutput(
color_resolution, dai.ImgFrame.Type.NV12, fps=args.fps_limit
)
left_output = left.requestFullResolutionOutput(
dai.ImgFrame.Type.NV12, fps=args.fps_limit
left_output = left.requestOutput(
size=(640, 480), type=dai.ImgFrame.Type.NV12, fps=args.fps_limit
)
right_output = right.requestFullResolutionOutput(
dai.ImgFrame.Type.NV12, fps=args.fps_limit
right_output = right.requestOutput(
size=(640, 480), type=dai.ImgFrame.Type.NV12, fps=args.fps_limit
)

stereo = pipeline.create(dai.node.StereoDepth).build(
Expand All @@ -40,8 +40,7 @@
stereo.setExtendedDisparity(True)
stereo.setLeftRightCheck(True)

depth_parser = pipeline.create(ApplyColormap).build(stereo.disparity)
# depth_parser.setMaxValue(int(stereo.initialConfig.getMaxDisparity())) # NOTE: Uncomment when DAI fixes a bug
depth_parser = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
depth_parser.setColormap(cv2.COLORMAP_JET)

encoder = pipeline.create(dai.node.VideoEncoder)
Expand Down
4 changes: 2 additions & 2 deletions tutorials/camera-stereo-depth/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
depthai==3.0.0
depthai-nodes==0.3.4
depthai==3.4.0
depthai-nodes==0.4.0
numpy>=1.22
opencv-python-headless~=4.10.0