|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | import cv2 |
3 | 3 | import depthai as dai |
4 | | -from depthai_nodes.node import ApplyColormap |
| 4 | +from depthai_nodes.node import ApplyDepthColormap |
5 | 5 | from typing import Optional |
6 | 6 | from utils.arguments import initialize_argparser |
7 | 7 |
|
|
10 | 10 | visualizer = dai.RemoteConnection(httpPort=8082) |
11 | 11 | device = dai.Device(dai.DeviceInfo(args.device)) if args.device else dai.Device() |
12 | 12 |
|
13 | | -STEREO_RESOLUTION = (800, 600) |
14 | 13 | NN_DIMENSIONS = (512, 288) |
15 | 14 |
|
16 | 15 | if not device.setIrLaserDotProjectorIntensity(1): |
|
73 | 72 | right=right_cam.requestFullResolutionOutput(dai.ImgFrame.Type.NV12), |
74 | 73 | presetMode=dai.node.StereoDepth.PresetMode.DEFAULT, |
75 | 74 | ) |
76 | | - stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A) |
77 | | - if platform == dai.Platform.RVC2: |
78 | | - stereo.setOutputSize(*STEREO_RESOLUTION) |
79 | 75 |
|
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) |
81 | 91 | coloredDepth.setColormap(cv2.COLORMAP_JET) |
82 | 92 | visualizer.addTopic("Depth", coloredDepth.out) |
83 | 93 |
|
|
0 commit comments