Skip to content

Commit b427b3f

Browse files
Merge pull request #398 from luxonis/tests_fixes
Fix examples/tests
2 parents b9f3fb6 + 6600b98 commit b427b3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+346
-467
lines changed

depthai-core

examples/CMakeLists.txt

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -87,97 +87,97 @@ endif()
8787
# Add examples
8888

8989
## Bootloader
90-
add_python_example(bootloader_config bootloader_config.py)
91-
add_python_example(bootloader_version bootloader_version.py)
92-
add_python_example(flash_bootloader flash_bootloader.py)
90+
# add_python_example(bootloader_config bootloader/bootloader_config.py)
91+
add_python_example(bootloader_version bootloader/bootloader_version.py)
92+
# add_python_example(flash_bootloader bootloader/flash_bootloader.py)
9393

9494
## Calibration
95-
add_python_example(calibration_flash_v5 calibration_flash_v5.py)
96-
add_python_example(calibration_flash calibration_flash.py)
97-
add_python_example(calibration_load calibration_load.py)
98-
add_python_example(calibration_reader calibration_reader.py)
95+
# add_python_example(calibration_flash_v5 calibration/calibration_flash_v5.py)
96+
# add_python_example(calibration_flash calibration/calibration_flash.py)
97+
add_python_example(calibration_load calibration/calibration_load.py)
98+
add_python_example(calibration_reader calibration/calibration_reader.py)
9999

100100
## ColorCamera
101-
add_python_example(autoexposure_roi autoexposure_roi.py)
102-
add_python_example(rgb_camera_control rgb_camera_control.py)
103-
add_python_example(rgb_preview rgb_preview.py)
104-
add_python_example(rgb_scene rgb_scene.py)
105-
add_python_example(rgb_video rgb_video.py)
101+
add_python_example(autoexposure_roi ColorCamera/autoexposure_roi.py)
102+
add_python_example(rgb_camera_control ColorCamera/rgb_camera_control.py)
103+
add_python_example(rgb_preview ColorCamera/rgb_preview.py)
104+
add_python_example(rgb_scene ColorCamera/rgb_scene.py)
105+
add_python_example(rgb_video ColorCamera/rgb_video.py)
106106

107107
## EdgeDetector
108-
add_python_example(edge_detector edge_detector.py)
108+
add_python_example(edge_detector EdgeDetector/edge_detector.py)
109109

110110
## FeatureTracker
111-
add_python_example(feature_tracker feature_tracker.py)
112-
add_python_example(feature_detector feature_detector.py)
111+
add_python_example(feature_tracker FeatureTracker/feature_tracker.py)
112+
add_python_example(feature_detector FeatureTracker/feature_detector.py)
113113

114114
## HostSide
115-
add_python_example(device_queue_event device_queue_event.py)
116-
add_python_example(opencv_support opencv_support.py)
117-
add_python_example(queue_add_callback queue_add_callback.py)
115+
add_python_example(device_queue_event host_side/device_queue_event.py)
116+
add_python_example(opencv_support host_side/opencv_support.py)
117+
add_python_example(queue_add_callback host_side/queue_add_callback.py)
118118

119119
## ImageManip
120-
add_python_example(image_manip_rotate image_manip_rotate.py)
121-
add_python_example(image_manip_tiling image_manip_tiling.py)
122-
add_python_example(rgb_rotate_warp rgb_rotate_warp.py)
120+
add_python_example(image_manip_rotate ImageManip/image_manip_rotate.py)
121+
add_python_example(image_manip_tiling ImageManip/image_manip_tiling.py)
122+
add_python_example(rgb_rotate_warp ImageManip/rgb_rotate_warp.py)
123123

124124
## IMU
125-
add_python_example(imu_gyroscope_accelerometer imu_gyroscope_accelerometer.py)
126-
add_python_example(imu_rotation_vector imu_rotation_vector.py)
125+
add_python_example(imu_gyroscope_accelerometer IMU/imu_gyroscope_accelerometer.py)
126+
add_python_example(imu_rotation_vector IMU/imu_rotation_vector.py)
127127

128128
## Mixed
129-
add_python_example(mono_depth_mobilenetssd mono_depth_mobilenetssd.py)
130-
add_python_example(rgb_encoding_mobilenet rgb_encoding_mobilenet.py)
131-
add_python_example(rgb_encoding_mono_mobilenet rgb_encoding_mono_mobilenet.py)
132-
add_python_example(rgb_encoding_mono_mobilenet_depth rgb_encoding_mono_mobilenet_depth.py)
129+
add_python_example(mono_depth_mobilenetssd mixed/mono_depth_mobilenetssd.py)
130+
add_python_example(rgb_encoding_mobilenet mixed/rgb_encoding_mobilenet.py)
131+
add_python_example(rgb_encoding_mono_mobilenet mixed/rgb_encoding_mono_mobilenet.py)
132+
add_python_example(rgb_encoding_mono_mobilenet_depth mixed/rgb_encoding_mono_mobilenet_depth.py)
133133

134134
## MobileNet
135-
add_python_example(mono_mobilenet mono_mobilenet.py)
136-
add_python_example(rgb_mobilenet_4k rgb_mobilenet_4k.py)
137-
add_python_example(rgb_mobilenet rgb_mobilenet.py)
138-
add_python_example(video_mobilenet video_mobilenet.py)
135+
add_python_example(mono_mobilenet MobileNet/mono_mobilenet.py)
136+
add_python_example(rgb_mobilenet_4k MobileNet/rgb_mobilenet_4k.py)
137+
add_python_example(rgb_mobilenet MobileNet/rgb_mobilenet.py)
138+
add_python_example(video_mobilenet MobileNet/video_mobilenet.py)
139139

140140
## MonoCamera
141-
add_python_example(mono_preview mono_preview.py)
142-
add_python_example(mono_full_resolution_saver mono_full_resolution_saver.py)
143-
add_python_example(mono_camera_control mono_camera_control.py)
141+
add_python_example(mono_preview MonoCamera/mono_preview.py)
142+
add_python_example(mono_full_resolution_saver MonoCamera/mono_full_resolution_saver.py)
143+
add_python_example(mono_camera_control MonoCamera/mono_camera_control.py)
144144

145145
## NeuralNetwork
146-
add_python_example(concat_multiple_input concat_multiple_input.py)
147-
add_python_example(normalization_multiple_input normalization_multiple_input.py)
146+
# add_python_example(concat_multiple_input NeuralNetwork/concat_multiple_input.py)
147+
# add_python_example(normalization_multiple_input NeuralNetwork/normalization_multiple_input.py)
148148

149149
## ObjectTracker
150-
add_python_example(object_tracker_video object_tracker_video.py)
151-
add_python_example(object_tracker object_tracker.py)
152-
add_python_example(spatial_object_tracker_mobilenet spatial_object_tracker_mobilenet.py)
153-
add_python_example(spatial_object_tracker_yolo spatial_object_tracker_yolo.py)
150+
add_python_example(object_tracker_video ObjectTracker/object_tracker_video.py)
151+
add_python_example(object_tracker ObjectTracker/object_tracker.py)
152+
add_python_example(spatial_object_tracker ObjectTracker/spatial_object_tracker.py)
153+
# add_python_example(spatial_object_tracker_yolo ObjectTracker/spatial_object_tracker_yolo.py)
154154

155155
## Script
156-
add_python_example(script_camera_control script_camera_control.py)
156+
add_python_example(script_camera_control Script/script_camera_control.py)
157157

158158
## SpatialDetection
159-
add_python_example(spatial_tiny_yolo_v3 spatial_tiny_yolo.py)
160-
add_python_example(spatial_tiny_yolo_v4 spatial_tiny_yolo.py)
161-
add_python_example(spatial_mobilenet spatial_mobilenet.py)
162-
add_python_example(spatial_mobilenet_mono spatial_mobilenet_mono.py)
163-
add_python_example(spatial_location_calculator spatial_location_calculator.py)
159+
add_python_example(spatial_tiny_yolo_v3 SpatialDetection/spatial_tiny_yolo.py yolo3)
160+
add_python_example(spatial_tiny_yolo_v4 SpatialDetection/spatial_tiny_yolo.py yolo4)
161+
add_python_example(spatial_mobilenet SpatialDetection/spatial_mobilenet.py)
162+
add_python_example(spatial_mobilenet_mono SpatialDetection/spatial_mobilenet_mono.py)
163+
add_python_example(spatial_location_calculator SpatialDetection/spatial_location_calculator.py)
164164

165165
## StereoDepth
166-
add_python_example(depth_crop_control depth_crop_control.py)
167-
add_python_example(depth_preview depth_preview.py)
168-
add_python_example(rgb_depth_aligned rgb_depth_aligned.py)
169-
add_python_example(stereo_depth_from_host stereo_depth_from_host.py)
170-
add_python_example(stereo_depth_video stereo_depth_video.py)
166+
add_python_example(depth_crop_control StereoDepth/depth_crop_control.py)
167+
add_python_example(depth_preview StereoDepth/depth_preview.py)
168+
add_python_example(rgb_depth_aligned StereoDepth/rgb_depth_aligned.py)
169+
add_python_example(stereo_depth_from_host StereoDepth/stereo_depth_from_host.py)
170+
add_python_example(stereo_depth_video StereoDepth/stereo_depth_video.py)
171171

172172
## SystemLogger
173-
add_python_example(system_information system_information.py)
173+
add_python_example(system_information SystemLogger/system_information.py)
174174

175175
## VideoEncoder
176-
add_python_example(encoding_max_limit encoding_max_limit.py)
177-
add_python_example(rgb_encoding rgb_encoding.py)
178-
add_python_example(rgb_full_resolution_saver rgb_full_resolution_saver.py)
179-
add_python_example(rgb_mono_encoding rgb_mono_encoding.py)
176+
add_python_example(encoding_max_limit VideoEncoder/encoding_max_limit.py)
177+
add_python_example(rgb_encoding VideoEncoder/rgb_encoding.py)
178+
add_python_example(rgb_full_resolution_saver VideoEncoder/rgb_full_resolution_saver.py)
179+
add_python_example(rgb_mono_encoding VideoEncoder/rgb_mono_encoding.py)
180180

181181
## Yolo
182-
add_python_example(tiny_yolo_v3_device_side_decoding tiny_yolo_v3_device_side_decoding.py)
183-
add_python_example(tiny_yolo_v4_device_side_decoding tiny_yolo_v4_device_side_decoding.py)
182+
add_python_example(tiny_yolo_v3_device_side_decoding Yolo/tiny_yolo.py yolo3)
183+
add_python_example(tiny_yolo_v4_device_side_decoding Yolo/tiny_yolo.py yolo4)

examples/ColorCamera/autoexposure_roi.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@
2424
pipeline = dai.Pipeline()
2525

2626
# Define source and outputs
27-
camRgb = pipeline.createColorCamera()
27+
camRgb = pipeline.create(dai.node.ColorCamera)
2828
camRgb.setPreviewSize(*previewSize)
2929
camRgb.setInterleaved(False)
3030

31-
camControlIn = pipeline.createXLinkIn()
31+
camControlIn = pipeline.create(dai.node.XLinkIn)
3232
camControlIn.setStreamName('camControl')
3333
camControlIn.out.link(camRgb.inputControl)
3434

3535
# Define a neural network that will make predictions based on the source frames
36-
nn = pipeline.createMobileNetDetectionNetwork()
36+
nn = pipeline.create(dai.node.MobileNetDetectionNetwork)
3737
nn.setConfidenceThreshold(0.5)
3838
nn.setBlobPath(nnPath)
3939
nn.setNumInferenceThreads(2)
4040
nn.input.setBlocking(False)
4141
camRgb.preview.link(nn.input)
4242

4343
# Linking
44-
xoutRgb = pipeline.createXLinkOut()
44+
xoutRgb = pipeline.create(dai.node.XLinkOut)
4545
xoutRgb.setStreamName("rgb")
4646
camRgb.preview.link(xoutRgb.input)
4747

48-
nnOut = pipeline.createXLinkOut()
48+
nnOut = pipeline.create(dai.node.XLinkOut)
4949
nnOut.setStreamName("nn")
5050
nn.out.link(nnOut.input)
5151

examples/ColorCamera/rgb_camera_control.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ def clamp(num, v0, v1):
3030
pipeline = dai.Pipeline()
3131

3232
# Define sources and outputs
33-
camRgb = pipeline.createColorCamera()
34-
videoEncoder = pipeline.createVideoEncoder()
35-
stillEncoder = pipeline.createVideoEncoder()
36-
37-
controlIn = pipeline.createXLinkIn()
38-
configIn = pipeline.createXLinkIn()
39-
videoMjpegOut = pipeline.createXLinkOut()
40-
stillMjpegOut = pipeline.createXLinkOut()
41-
previewOut = pipeline.createXLinkOut()
33+
camRgb = pipeline.create(dai.node.ColorCamera)
34+
videoEncoder = pipeline.create(dai.node.VideoEncoder)
35+
stillEncoder = pipeline.create(dai.node.VideoEncoder)
36+
37+
controlIn = pipeline.create(dai.node.XLinkIn)
38+
configIn = pipeline.create(dai.node.XLinkIn)
39+
videoMjpegOut = pipeline.create(dai.node.XLinkOut)
40+
stillMjpegOut = pipeline.create(dai.node.XLinkOut)
41+
previewOut = pipeline.create(dai.node.XLinkOut)
4242

4343
controlIn.setStreamName('control')
4444
configIn.setStreamName('config')

examples/ColorCamera/rgb_preview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
pipeline = dai.Pipeline()
88

99
# Define source and output
10-
camRgb = pipeline.createColorCamera()
11-
xoutRgb = pipeline.createXLinkOut()
10+
camRgb = pipeline.create(dai.node.ColorCamera)
11+
xoutRgb = pipeline.create(dai.node.XLinkOut)
1212

1313
xoutRgb.setStreamName("rgb")
1414

examples/ColorCamera/rgb_scene.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
# Create pipeline
1111
pipeline = dai.Pipeline()
1212

13-
camRgb = pipeline.createColorCamera()
13+
camRgb = pipeline.create(dai.node.ColorCamera)
1414
camRgb.setIspScale(1,3)
1515

16-
xoutRgb = pipeline.createXLinkOut()
16+
xoutRgb = pipeline.create(dai.node.XLinkOut)
1717
xoutRgb.setStreamName("video")
1818
camRgb.video.link(xoutRgb.input)
1919

20-
camControlIn = pipeline.createXLinkIn()
20+
camControlIn = pipeline.create(dai.node.XLinkIn)
2121
camControlIn.setStreamName("camControl")
2222
camControlIn.out.link(camRgb.inputControl)
2323

examples/ColorCamera/rgb_video.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
pipeline = dai.Pipeline()
88

99
# Define source and output
10-
camRgb = pipeline.createColorCamera()
11-
xoutVideo = pipeline.createXLinkOut()
10+
camRgb = pipeline.create(dai.node.ColorCamera)
11+
xoutVideo = pipeline.create(dai.node.XLinkOut)
1212

1313
xoutVideo.setStreamName("video")
1414

examples/EdgeDetector/edge_detector.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
pipeline = dai.Pipeline()
99

1010
# Define sources and outputs
11-
camRgb = pipeline.createColorCamera()
12-
monoLeft = pipeline.createMonoCamera()
13-
monoRight = pipeline.createMonoCamera()
14-
15-
edgeDetectorLeft = pipeline.createEdgeDetector()
16-
edgeDetectorRight = pipeline.createEdgeDetector()
17-
edgeDetectorRgb = pipeline.createEdgeDetector()
18-
19-
xoutEdgeLeft = pipeline.createXLinkOut()
20-
xoutEdgeRight = pipeline.createXLinkOut()
21-
xoutEdgeRgb = pipeline.createXLinkOut()
22-
xinEdgeCfg = pipeline.createXLinkIn()
11+
camRgb = pipeline.create(dai.node.ColorCamera)
12+
monoLeft = pipeline.create(dai.node.MonoCamera)
13+
monoRight = pipeline.create(dai.node.MonoCamera)
14+
15+
edgeDetectorLeft = pipeline.create(dai.node.EdgeDetector)
16+
edgeDetectorRight = pipeline.create(dai.node.EdgeDetector)
17+
edgeDetectorRgb = pipeline.create(dai.node.EdgeDetector)
18+
19+
xoutEdgeLeft = pipeline.create(dai.node.XLinkOut)
20+
xoutEdgeRight = pipeline.create(dai.node.XLinkOut)
21+
xoutEdgeRgb = pipeline.create(dai.node.XLinkOut)
22+
xinEdgeCfg = pipeline.create(dai.node.XLinkIn)
2323

2424
edgeLeftStr = "edge left"
2525
edgeRightStr = "edge right"

examples/IMU/imu_gyroscope_accelerometer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
pipeline = dai.Pipeline()
1010

1111
# Define sources and outputs
12-
imu = pipeline.createIMU()
13-
xlinkOut = pipeline.createXLinkOut()
12+
imu = pipeline.create(dai.node.IMU)
13+
xlinkOut = pipeline.create(dai.node.XLinkOut)
1414

1515
xlinkOut.setStreamName("imu")
1616

examples/IMU/imu_rotation_vector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
pipeline = dai.Pipeline()
1010

1111
# Define sources and outputs
12-
imu = pipeline.createIMU()
13-
xlinkOut = pipeline.createXLinkOut()
12+
imu = pipeline.create(dai.node.IMU)
13+
xlinkOut = pipeline.create(dai.node.XLinkOut)
1414

1515
xlinkOut.setStreamName("imu")
1616

0 commit comments

Comments
 (0)