Skip to content

Commit 615f440

Browse files
csaba-luxonisErol444
authored andcommitted
Synchronize with cpp
1 parent 532b327 commit 615f440

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

docs/source/tutorials/code_samples.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Code samples are used for automated testing. They are also a great starting poin
1818
- :ref:`RGB video` - Displays high resolution frames of the RGB camera
1919
- :ref:`Mono Preview` - Displays right/left mono cameras
2020
- :ref:`Depth Preview` - Displays colorized stereo disparity
21-
- :ref:`Device Queue Event` - Demonstrates how to use device queue events
2221
- :ref:`RGB Encoding` - Encodes RGB (1080P, 30FPS) into :code:`.h265` and saves it on the host
2322
- :ref:`RGB & Mono Encoding`- Encodes RGB (1080P, 30FPS) and both mono streams (720P, 30FPS) into :code:`.h265`/:code:`.h264` and saves them on the host
2423
- :ref:`Encoding Max Limit` - Encodes RGB (4k 25FPS) and both mono streams (720P, 25FPS) into :code:`.h265`/:code:`.h264` and saves them on the host
@@ -56,4 +55,6 @@ Code samples are used for automated testing. They are also a great starting poin
5655
.. rubric:: Mixed
5756

5857
- :ref:`System information` - Displays device system information (memory/cpu usage, temperature)
59-
- :ref:`OpenCV support` - Demonstrates how to retrieve an image frame as an OpenCV frame
58+
- :ref:`OpenCV support` - Demonstrates how to retrieve an image frame as an OpenCV frame
59+
- :ref:`Device Queue Event` - Demonstrates how to use device queue events
60+
- :ref:`Queue add callback` - Demonstrates how to use queue callbacks

docs/source/tutorials/mixed_samples.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ Mixed
88

99
../samples/system_information.rst
1010
../samples/opencv_support.rst
11+
../samples/device_queue_event.rst
1112
../samples/queue_add_callback.rst
1213

1314
- :ref:`System information` - Displays device system information (memory/cpu usage, temperature)
1415
- :ref:`OpenCV support` - Demonstrates how to retrieve an image frame as an OpenCV frame
16+
- :ref:`Device Queue Event` - Demonstrates how to use device queue events
1517
- :ref:`Queue add callback` - Demonstrates how to use queue callbacks

docs/source/tutorials/simple_samples.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Simple
1010
../samples/rgb_video.rst
1111
../samples/mono_preview.rst
1212
../samples/depth_preview.rst
13-
../samples/device_queue_event.rst
1413
../samples/rgb_encoding.rst
1514
../samples/rgb_mono_encoding.rst
1615
../samples/encoding_max_limit.rst
@@ -27,7 +26,6 @@ These samples are great starting point for the gen2 API.
2726
- :ref:`RGB video` - Displays high resolution frames of the RGB camera
2827
- :ref:`Mono Preview` - Displays right/left mono cameras
2928
- :ref:`Depth Preview` - Displays colorized stereo disparity
30-
- :ref:`Device Queue Event` - Demonstrates how to use device queue events
3129
- :ref:`RGB Encoding` - Encodes RGB (1080P, 30FPS) into :code:`.h265` and saves it on the host
3230
- :ref:`RGB & Mono Encoding`- Encodes RGB (1080P, 30FPS) and both mono streams (720P, 30FPS) into :code:`.h265`/:code:`.h264` and saves them on the host
3331
- :ref:`Encoding Max Limit` - Encodes RGB (4k 25FPS) and both mono streams (720P, 25FPS) into :code:`.h265`/:code:`.h264` and saves them on the host

examples/queue_add_callback.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,32 @@
33
import depthai as dai
44
import queue
55

6-
# Start defining a pipeline
6+
# Create pipeline
77
pipeline = dai.Pipeline()
88

99
# Add all three cameras
1010
camRgb = pipeline.createColorCamera()
11-
camRgb.setPreviewSize(300, 300)
12-
1311
left = pipeline.createMonoCamera()
14-
left.setBoardSocket(dai.CameraBoardSocket.LEFT)
15-
left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
16-
1712
right = pipeline.createMonoCamera()
18-
right.setBoardSocket(dai.CameraBoardSocket.RIGHT)
19-
right.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
2013

2114
# Create XLink output
2215
xout = pipeline.createXLinkOut()
2316
xout.setStreamName("frames")
2417

18+
# Properties
19+
camRgb.setPreviewSize(300, 300)
20+
left.setBoardSocket(dai.CameraBoardSocket.LEFT)
21+
left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
22+
right.setBoardSocket(dai.CameraBoardSocket.RIGHT)
23+
right.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
24+
2525
# Stream all the camera streams through the same XLink node
2626
camRgb.preview.link(xout.input)
2727
left.out.link(xout.input)
2828
right.out.link(xout.input)
2929

3030
q = queue.Queue()
3131

32-
3332
def newFrame(inFrame):
3433
global q
3534
# Get "stream name" from the instance number
@@ -40,10 +39,8 @@ def newFrame(inFrame):
4039
# run image processing algorithms here
4140
q.put({"name": name, "frame": frame})
4241

43-
44-
# Pipeline is defined, now we can connect to the device
42+
# Connect to device and start pipeline
4543
with dai.Device(pipeline) as device:
46-
device.startPipeline()
4744

4845
# Add callback to the output queue "frames" for all newly arrived frames (color, left, right)
4946
device.getOutputQueue(name="frames", maxSize=4, blocking=False).addCallback(newFrame)

0 commit comments

Comments
 (0)