Skip to content

Commit d9f6b8b

Browse files
committed
Added an ColorCamera isp scale example, and modified test workflow
1 parent a4fa240 commit d9f6b8b

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ add_python_example(rgb_camera_control ColorCamera/rgb_camera_control.py)
109109
add_python_example(rgb_preview ColorCamera/rgb_preview.py)
110110
add_python_example(rgb_scene ColorCamera/rgb_scene.py)
111111
add_python_example(rgb_video ColorCamera/rgb_video.py)
112+
add_python_example(rgb_isp_scale ColorCamera/rgb_isp_scale.py)
112113

113114
## EdgeDetector
114115
add_python_example(edge_detector EdgeDetector/edge_detector.py)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
3+
import cv2
4+
import depthai as dai
5+
6+
# Create pipeline
7+
pipeline = dai.Pipeline()
8+
9+
# Define source and output
10+
camRgb = pipeline.create(dai.node.ColorCamera)
11+
xoutVideo = pipeline.create(dai.node.XLinkOut)
12+
13+
xoutVideo.setStreamName("video")
14+
15+
# Properties
16+
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
17+
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4_K)
18+
camRgb.setIspScale(1, 2)
19+
camRgb.setVideoSize(1920, 1080)
20+
21+
xoutVideo.input.setBlocking(False)
22+
xoutVideo.input.setQueueSize(1)
23+
24+
# Linking
25+
camRgb.video.link(xoutVideo.input)
26+
27+
# Connect to device and start pipeline
28+
with dai.Device(pipeline) as device:
29+
30+
video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
31+
32+
while True:
33+
videoIn = video.get()
34+
35+
# Get BGR frame from NV12 encoded video frame to show with opencv
36+
# Visualizing the frame on slower hosts might have overhead
37+
cv2.imshow("video", videoIn.getCvFrame())
38+
39+
if cv2.waitKey(1) == ord('q'):
40+
break

0 commit comments

Comments
 (0)