Skip to content

Commit cb4bb2a

Browse files
authored
Merge pull request #806 from luxonis/apply_colordepth_update
Update ApplyColormap -> ApplyDepthColormap
2 parents bf819b8 + 5b32dd3 commit cb4bb2a

File tree

15 files changed

+78
-39
lines changed

15 files changed

+78
-39
lines changed

apps/default-app/main.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
import cv2
33
import depthai as dai
4-
from depthai_nodes.node import ApplyColormap
4+
from depthai_nodes.node import ApplyDepthColormap
55
from typing import Optional
66
from utils.arguments import initialize_argparser
77

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

13-
STEREO_RESOLUTION = (800, 600)
1413
NN_DIMENSIONS = (512, 288)
1514

1615
if not device.setIrLaserDotProjectorIntensity(1):
@@ -73,11 +72,22 @@
7372
right=right_cam.requestFullResolutionOutput(dai.ImgFrame.Type.NV12),
7473
presetMode=dai.node.StereoDepth.PresetMode.DEFAULT,
7574
)
76-
stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)
77-
if platform == dai.Platform.RVC2:
78-
stereo.setOutputSize(*STEREO_RESOLUTION)
7975

80-
coloredDepth = pipeline.create(ApplyColormap).build(stereo.disparity)
76+
# RVC4 does not support stereo.setDepthAlign, ImageAlign node used instead
77+
if platform == dai.Platform.RVC4:
78+
cam_out = cameraNode.requestOutput(
79+
(640, 480), type=dai.ImgFrame.Type.NV12, enableUndistortion=True
80+
)
81+
align = pipeline.create(dai.node.ImageAlign)
82+
stereo.depth.link(align.input)
83+
cam_out.link(align.inputAlignTo)
84+
coloredDepth = pipeline.create(ApplyDepthColormap).build(
85+
align.outputAligned
86+
)
87+
else:
88+
stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)
89+
stereo.setOutputSize(800, 600)
90+
coloredDepth = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
8191
coloredDepth.setColormap(cv2.COLORMAP_JET)
8292
visualizer.addTopic("Depth", coloredDepth.out)
8393

apps/default-app/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
depthai==3.0.0
2-
depthai-nodes==0.3.4
1+
depthai==3.4.0
2+
depthai-nodes==0.4.0
33
opencv-python-headless==4.10.0.84
44
numpy>=1.22

apps/p2p-measurement/backend/src/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import depthai as dai
2-
from depthai_nodes.node import ApplyColormap
2+
from depthai_nodes.node import ApplyDepthColormap
33
import numpy as np
44
import cv2
55

@@ -58,9 +58,8 @@
5858
stereo.depth.link(align.input)
5959
cam_out.link(align.inputAlignTo)
6060

61-
coloredDepth = pipeline.create(ApplyColormap).build(align.outputAligned)
61+
coloredDepth = pipeline.create(ApplyDepthColormap).build(align.outputAligned)
6262
coloredDepth.setColormap(cv2.COLORMAP_JET)
63-
coloredDepth.setDepthPreset()
6463

6564
point_tracker = pipeline.create(
6665
PointTracker, frame_width=FRAME_WIDTH, frame_height=FRAME_HEIGHT
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
depthai==3.2.1
2-
#depthai-nodes==0.3.7
3-
depthai-nodes @ git+https://github.com/luxonis/depthai-nodes.git@c0f382fbe6514b62b8e98b6b805e5023c9c9438c # depth visualization in ApplyColormap
1+
depthai==3.3.0
2+
depthai-nodes==0.4.0
43
opencv-contrib-python==4.12.0.88
54
numpy>=1.22

depth-measurement/calc-spatial-on-host/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import depthai as dai
55
from utils.roi_control import ROIControl
66
from utils.arguments import initialize_argparser
7-
from depthai_nodes.node import ApplyColormap
7+
from depthai_nodes.node import ApplyDepthColormap
88
from utils.measure_distance import MeasureDistance
99

1010

@@ -28,7 +28,7 @@
2828
monoLeft, monoRight, presetMode=dai.node.StereoDepth.PresetMode.DEFAULT
2929
)
3030

31-
depth_color_transform = pipeline.create(ApplyColormap).build(stereo.disparity)
31+
depth_color_transform = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
3232
depth_color_transform.setColormap(cv2.COLORMAP_JET)
3333

3434
measure_distance = pipeline.create(MeasureDistance).build(

depth-measurement/calc-spatial-on-host/oakapp.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ prepare_build_container = []
1313
build_steps = []
1414

1515
entrypoint = ["bash", "-c", "python3 -u /app/main.py"]
16+
17+
[base_image]
18+
api_url = "https://registry-1.docker.io"
19+
service = "registry.docker.io"
20+
oauth_url = "https://auth.docker.io/token"
21+
auth_type = "repository"
22+
auth_name = "luxonis/oakapp-base"
23+
image_name = "luxonis/oakapp-base"
24+
image_tag = "1.2.6"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
depthai==3.0.0
2-
depthai-nodes==0.3.4
1+
depthai==3.4.0
2+
depthai-nodes==0.4.0
33
opencv-python-headless==4.10.0.84
44
numpy>=1.22

depth-measurement/stereo-runtime-configuration/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cv2
22
import depthai as dai
3-
from depthai_nodes.node import ApplyColormap
3+
from depthai_nodes.node import ApplyDepthColormap
44
from utils.arguments import initialize_argparser
55
from utils.stereo_config_controller import StereoConfigController
66

@@ -36,7 +36,7 @@
3636
stereo_controller = pipeline.create(StereoConfigController).build(preview=preview)
3737
stereo_controller.out_cfg.link(stereo.inputConfig)
3838

39-
depth_color = pipeline.create(ApplyColormap).build(arr=stereo.disparity)
39+
depth_color = pipeline.create(ApplyDepthColormap).build(stereo.disparity)
4040
depth_color.setColormap(cv2.COLORMAP_JET)
4141

4242
sync = pipeline.create(dai.node.Sync)

depth-measurement/stereo-runtime-configuration/oakapp.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@ prepare_build_container = []
1313
build_steps = []
1414

1515
entrypoint = ["bash", "-c", "python3 -u /app/main.py"]
16+
17+
[base_image]
18+
api_url = "https://registry-1.docker.io"
19+
service = "registry.docker.io"
20+
oauth_url = "https://auth.docker.io/token"
21+
auth_type = "repository"
22+
auth_name = "luxonis/oakapp-base"
23+
image_name = "luxonis/oakapp-base"
24+
image_tag = "1.2.6"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
depthai==3.0.0
2-
depthai-nodes==0.3.4
3-
opencv-python-headless~=4.10.0
1+
depthai==3.4.0
2+
depthai-nodes==0.4.0
3+
opencv-python-headless~=4.10.0

0 commit comments

Comments
 (0)