Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting support (Python 3.9) #316

Merged
merged 39 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
62db8e0
Adding micropython.
Feb 19, 2021
f1c4b9c
Merge branch 'gen2_develop' into gen2_micropython
themarpe Feb 21, 2021
423b72c
Pipeline::create and dai.node submodule capability
themarpe Feb 22, 2021
0d5ecd3
Added Node::InputMap and Node::OutputMap
themarpe Feb 22, 2021
57fdd1c
Checking in micropython asset changes.
Mar 30, 2021
5a59aae
Adding load method for assetManager.
Mar 31, 2021
f47c954
Renaming MicroPython node to LxScript.
Mar 31, 2021
27c061c
Merge branch 'develop' into gen2_micropython
themarpe Apr 3, 2021
49112fb
Improved documentation resolvment and 'pipeline.create'
themarpe Apr 3, 2021
9b77f1b
Added a simple scripting example
themarpe Apr 4, 2021
0f0c284
Updated core
themarpe Apr 4, 2021
dee4947
Renamed node 'LxScript' to 'Script' and deprecated pipeline.create[No…
themarpe Apr 4, 2021
be5c18d
Releasing GIL on long function calls
themarpe Apr 6, 2021
9873cee
Updating firmware and adding a check to raw PoBuf parsing.
Apr 7, 2021
32b38e5
Update firmware (bug with multiple scripting nodes).
Apr 9, 2021
8c8e756
Updated core
themarpe Apr 13, 2021
8c9d95e
Updating firmware (Fixing datetime on ImgFrame::getTimestamp)
Apr 14, 2021
4b6f3a1
Merge branch 'develop' into gen2_scripting
themarpe May 11, 2021
c90abbb
Updated core
themarpe Jun 11, 2021
efb992b
Merge branch 'develop' into gen2_scripting
themarpe Jun 24, 2021
761d5e6
Updated core
themarpe Jun 24, 2021
7baf504
Update core
SzabolcsGergely Jun 25, 2021
c30993d
Updated core with Script improvements
themarpe Jun 26, 2021
c116e8b
Merge branch 'gen2_scripting' of github.com:luxonis/depthai-python in…
themarpe Jun 26, 2021
5cdb746
Merge remote-tracking branch 'origin/develop' into gen2_scripting
alex-luxonis Jun 30, 2021
80374c0
Merge branch 'develop' into gen2_scripting
themarpe Jul 15, 2021
2fcf18a
Updated core
themarpe Jul 15, 2021
eb25094
Updated core
themarpe Jul 16, 2021
4ad4bd8
Updated core
themarpe Jul 16, 2021
b5e69c4
Merge branch 'develop' into gen2_scripting
themarpe Jul 19, 2021
2068884
Updated EdgeDetector docs
themarpe Jul 19, 2021
6c55249
Updated core
themarpe Jul 19, 2021
b6eeee5
Merge branch 'develop' into gen2_scripting
themarpe Jul 20, 2021
62faa23
Updated pybind11 to 2.7.0, modifed example and fixed some bindings
themarpe Jul 21, 2021
eba4870
Added script node docs
Erol444 Jul 22, 2021
c140095
Added demo gif
Erol444 Jul 22, 2021
73551d0
Merge branch 'develop' into gen2_scripting
themarpe Jul 23, 2021
bfd8922
Updated script node docs - PR review suggestions
Erol444 Jul 23, 2021
4aa7235
Merge remote-tracking branch 'origin/scripting_docs' into gen2_scripting
themarpe Jul 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/source/components/nodes/color_camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
cam = pipeline.createColorCamera()
cam = pipeline.create(dai.node.ColorCamera)

.. code-tab:: c++

Expand Down Expand Up @@ -67,7 +67,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
cam = pipeline.createColorCamera()
cam = pipeline.create(dai.node.ColorCamera)
cam.setPreviewSize(300, 300)
cam.setBoardSocket(dai.CameraBoardSocket.RGB)
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
Expand Down Expand Up @@ -98,7 +98,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.ColorCamera
.. autoclass:: depthai.node.ColorCamera
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/edge_detector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
edgeDetector = pipeline.createEdgeDetector()
edgeDetector = pipeline.create(dai.node.EdgeDetector)

.. code-tab:: c++

Expand Down Expand Up @@ -48,7 +48,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
edgeDetector = pipeline.createEdgeDetector()
edgeDetector = pipeline.create(dai.node.EdgeDetector)

sobelHorizontalKernel = [[1, 0, -1], [2, 0, -2], [1, 0, -1]]
sobelVerticalKernel = [[1, 2, 1], [0, 0, 0], [-1, -2, -1]]
Expand All @@ -75,7 +75,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.EdgeDetector
.. autoclass:: depthai.node.EdgeDetector
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/image_manip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
manip = pipeline.createImageManip()
manip = pipeline.create(dai.node.ImageManip)

.. code-tab:: c++

Expand Down Expand Up @@ -52,7 +52,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
manip = pipeline.createImageManip()
manip = pipeline.create(dai.node.ImageManip)

manip.initialConfig.setResize(300, 300)
manip.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p)
Expand All @@ -79,7 +79,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.ImageManip
.. autoclass:: depthai.node.ImageManip
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/mobilenet_detection_network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
mobilenetDet = pipeline.createMobileNetDetectionNetwork()
mobilenetDet = pipeline.create(dai.node.MobileNetDetectionNetwork)

.. code-tab:: c++

Expand Down Expand Up @@ -50,7 +50,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
mobilenetDet = pipeline.createMobileNetDetectionNetwork()
mobilenetDet = pipeline.create(dai.node.MobileNetDetectionNetwork)

mobilenetDet.setConfidenceThreshold(0.5)
mobilenetDet.setBlobPath(nnBlobPath)
Expand Down Expand Up @@ -81,7 +81,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.MobileNetDetectionNetwork
.. autoclass:: depthai.node.MobileNetDetectionNetwork
:members:
:inherited-members:
:noindex:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
mobilenetSpatial = pipeline.createMobileNetSpatialDetectionNetwork()
mobilenetSpatial = pipeline.create(dai.node.MobileNetSpatialDetectionNetwork)

.. code-tab:: c++

Expand Down Expand Up @@ -52,7 +52,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
mobilenetSpatial = pipeline.createMobileNetSpatialDetectionNetwork()
mobilenetSpatial = pipeline.create(dai.node.MobileNetSpatialDetectionNetwork)

mobilenetSpatial.setBlobPath(nnBlobPath)
# Will ingore all detections whose confidence is below 50%
Expand Down Expand Up @@ -98,7 +98,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.MobileNetSpatialDetectionNetwork
.. autoclass:: depthai.node.MobileNetSpatialDetectionNetwork
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/mono_camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
mono = pipeline.createMonoCamera()
mono = pipeline.create(dai.node.MonoCamera)

.. code-tab:: c++

Expand Down Expand Up @@ -48,7 +48,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
mono = pipeline.createMonoCamera()
mono = pipeline.create(dai.node.MonoCamera)
mono.setBoardSocket(dai.CameraBoardSocket.RIGHT)
mono.setResolution(dai.MonoCameraProperties.SensorResolution.THE_720_P)

Expand All @@ -73,7 +73,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.MonoCamera
.. autoclass:: depthai.node.MonoCamera
:members:
:inherited-members:
:noindex:
Expand Down
8 changes: 4 additions & 4 deletions docs/source/components/nodes/neural_network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
nn = pipeline.createNeuralNetwork()
nn = pipeline.create(dai.node.NeuralNetwork)

.. code-tab:: c++

Expand Down Expand Up @@ -60,12 +60,12 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
nn = pipeline.createNeuralNetwork()
nn = pipeline.create(dai.node.NeuralNetwork)
nn.setBlobPath(bbBlobPath)
cam.out.link(nn.input)

# Send NN out to the host via XLink
nnXout = pipeline.createXLinkOut()
nnXout = pipeline.create(dai.node.XLinkOut)
nnXout.setStreamName("nn")
nn.out.link(nnXout.input)

Expand Down Expand Up @@ -124,7 +124,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.NeuralNetwork
.. autoclass:: depthai.node.NeuralNetwork
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/object_tracker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
objectTracker = pipeline.createObjectTracker()
objectTracker = pipeline.create(dai.node.ObjectTracker)

.. code-tab:: c++

Expand Down Expand Up @@ -53,7 +53,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
objectTracker = pipeline.createObjectTracker()
objectTracker = pipeline.create(dai.node.ObjectTracker)

objectTracker.setDetectionLabelsToTrack([15]) # Track only person
# Possible tracking types: ZERO_TERM_COLOR_HISTOGRAM, ZERO_TERM_IMAGELESS
Expand Down Expand Up @@ -92,7 +92,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.ObjectTracker
.. autoclass:: depthai.node.ObjectTracker
:members:
:inherited-members:
:noindex:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.SpatialLocationCalculator
.. autoclass:: depthai.node.SpatialLocationCalculator
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/spi_out.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
spi = pipeline.createSPIOut()
spi = pipeline.create(dai.node.SPIOut)

.. code-tab:: c++

Expand Down Expand Up @@ -46,7 +46,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
spi = pipeline.createSPIOut()
spi = pipeline.create(dai.node.SPIOut)

spi.setStreamName("spimetaout")
spi.setBusId(0)
Expand All @@ -72,7 +72,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.SPIOut
.. autoclass:: depthai.node.SPIOut
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/stereo_depth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
stereo = pipeline.createStereoDepth()
stereo = pipeline.create(dai.node.StereoDepth)

.. code-tab:: c++

Expand Down Expand Up @@ -127,7 +127,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
stereo = pipeline.createStereoDepth()
stereo = pipeline.create(dai.node.StereoDepth)

# Better handling for occlusions:
stereo.setLeftRightCheck(False)
Expand Down Expand Up @@ -170,7 +170,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.StereoDepth
.. autoclass:: depthai.node.StereoDepth
:members:
:inherited-members:
:noindex:
Expand Down
8 changes: 4 additions & 4 deletions docs/source/components/nodes/system_logger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
logger = pipeline.createSystemLogger()
logger = pipeline.create(dai.node.SystemLogger)

.. code-tab:: c++

Expand Down Expand Up @@ -44,11 +44,11 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
logger = pipeline.createSystemLogger()
logger = pipeline.create(dai.node.SystemLogger)
logger.setRate(1) # 1 Hz

# Send system info to the host via XLink
xout = pipeline.createXLinkOut()
xout = pipeline.create(dai.node.XLinkOut)
xout.setStreamName("sysinfo")
logger.out.link(xout.input)

Expand Down Expand Up @@ -76,7 +76,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.SystemLogger
.. autoclass:: depthai.node.SystemLogger
:members:
:inherited-members:
:noindex:
Expand Down
10 changes: 5 additions & 5 deletions docs/source/components/nodes/video_encoder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
encoder = pipeline.createVideoEncoder()
encoder = pipeline.create(dai.node.VideoEncoder)

.. code-tab:: c++

Expand Down Expand Up @@ -48,11 +48,11 @@ Usage

# Create ColorCamera beforehand
# Set H265 encoding for the ColorCamera video output
videoEncoder = pipeline.createVideoEncoder()
videoEncoder = pipeline.create(dai.node.VideoEncoder)
videoEncoder.setDefaultProfilePreset(cam.getVideoSize(), cam.getFps(), dai.VideoEncoderProperties.Profile.H265_MAIN)

# Create MJPEG encoding for still images
stillEncoder = pipeline.createVideoEncoder()
stillEncoder = pipeline.create(dai.node.VideoEncoder)
stillEncoder.setDefaultProfilePreset(cam.getStillSize(), 1, dai.VideoEncoderProperties.Profile.MJPEG)

cam.still.link(stillEncoder.input)
Expand All @@ -68,7 +68,7 @@ Usage
videoEncoder->setDefaultProfilePreset(cam->getVideoSize(), cam->getFps(), dai::VideoEncoderProperties::Profile::H265_MAIN);

// Create MJPEG encoding for still images
stillEncoder = pipeline.createVideoEncoder();
stillEncoder = pipeline.create(dai.node.VideoEncoder);
stillEncoder->setDefaultProfilePreset(cam->getStillSize(), 1, dai::VideoEncoderProperties::Profile::MJPEG);

cam->still.link(stillEncoder->input);
Expand All @@ -89,7 +89,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.VideoEncoder
.. autoclass:: depthai.node.VideoEncoder
:members:
:inherited-members:
:noindex:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/components/nodes/xlink_in.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ How to place it
.. code-tab:: py

pipeline = dai.Pipeline()
xlinkIn = pipeline.createXLinkIn()
xlinkIn = pipeline.create(dai.node.XLinkIn)

.. code-tab:: c++

Expand Down Expand Up @@ -44,7 +44,7 @@ Usage
.. code-tab:: py

pipeline = dai.Pipeline()
xIn = pipeline.createXLinkIn()
xIn = pipeline.create(dai.node.XLinkIn)
xIn.setStreamName("camControl")

# Create ColorCamera beforehand
Expand Down Expand Up @@ -95,7 +95,7 @@ Reference

.. tab:: Python

.. autoclass:: depthai.XLinkIn
.. autoclass:: depthai.node.XLinkIn
:members:
:inherited-members:
:noindex:
Expand Down
Loading