Skip to content

Commit

Permalink
Merge branch 'main' into update_depth_visualziation
Browse files Browse the repository at this point in the history
  • Loading branch information
Erol444 authored Apr 24, 2023
2 parents b0fa0fe + f5117cc commit 42d9f27
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docs/requirements_mkdoc.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
git+https://github.com/luxonis/pybind11_mkdoc.git@47a353ae22a3ca2fe1ca47f47b38613dcfb1043b
git+https://github.com/luxonis/pybind11_mkdoc.git@59746f8d1645c9f00ebfb534186334d0154b5bd6
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/components/nodes/stereo_depth.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
StereoDepth
###########

StereoDepth node calculates the disparity/depth from the stereo camera pair (2x :ref:`MonoCamera <MonoCamera>`/:ref:`ColorCamera`).
StereoDepth node calculates the disparity and/or depth from the stereo camera pair (2x :ref:`MonoCamera <MonoCamera>`/:ref:`ColorCamera`).
We suggest following :ref:`Configuring Stereo Depth` tutorial to achieve the best depth results.

How to place it
===============
Expand Down
27 changes: 2 additions & 25 deletions docs/source/includes/footer-short.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
.. raw:: html

<h2>Got questions?</h2>
<h2>Got questions?</h2>

We're always happy to help with code or other questions you might have.

.. raw:: html

<div class="cta-row cta-row-short">
<div class="cta-box">
<a href="https://discord.gg/luxonis">
<img src="https://docs.luxonis.com/en/latest/_images/discord.png" alt="Discord"/>
<h5 class="cta-title">Community Discord</h5>
</a>
</div>
<div class="cta-box">
<a href="https://discuss.luxonis.com/">
<img src="https://docs.luxonis.com/en/latest/_images/forum.png" alt="forum"/>
<h5 class="cta-title">Discussion Forum</h5>
</a>
</div>
<div class="cta-box">
<a href="mailto:[email protected]">
<img src="https://docs.luxonis.com/en/latest/_images/email.png" alt="forum"/>
<h5 class="cta-title">Email Support</h5>
</a>
</div>
</div>
Head over to <a href="https://discuss.luxonis.com/"><strong>Discussion Forum</strong></a> for technical support or any other questions you might have.
49 changes: 49 additions & 0 deletions docs/source/samples/Script/script_uart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Script UART communication
=========================

This example uses :ref:`Script` node for `UART communication <https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter>`__. Note that OAK
cameras don't have UART pins easily disposed, and we soldered wires on `OAK-FFC-4P <https://docs.luxonis.com/projects/hardware/en/latest/pages/DD2090.html>`__
to expose UART pins.

.. note::

This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration.

Demo
####

.. raw:: html

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
<iframe src="https://www.youtube.com/embed/nbS1BczO5sE" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
</div>


.. figure:: https://user-images.githubusercontent.com/18037362/232458809-a36dc418-6bb5-411f-9172-5130a926191d.jpg

Oscilloscope connected to the OAK-FFC-4P UART pins

Setup
#####

.. include:: /includes/install_from_pypi.rst

Source code
###########

.. tabs::

.. tab:: Python

Also `available on GitHub <https://github.com/luxonis/depthai-python/blob/main/examples/Script/script_uart.py>`__

.. literalinclude:: ../../../../examples/Script/script_uart.py
:language: python
:linenos:

.. tab:: C++

Not yet available


.. include:: /includes/footer-short.rst
1 change: 1 addition & 0 deletions docs/source/tutorials/code_samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ are presented with code.
- :ref:`Script HTTP server` - Serve still image over HTTP response (only OAK-POE devices)
- :ref:`Script MJPEG server` - Serve MJPEG video stream over HTTP response (only OAK-POE devices)
- :ref:`Script NNData example` - Constructs :ref:`NNData` in Script node and sends it to the host
- :ref:`Script UART communication` - UART communication with Script node

.. rubric:: SpatialDetection

Expand Down
6 changes: 3 additions & 3 deletions docs/source/tutorials/configuring-stereo-depth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ just note it's a very large output (eg. 1280*800*96 => 98MB for each frame).

Stereo Subpixel mode will calculate subpixel disparity by looking at the confidence values of the 2 neighboring disparity pixels in each direction.
In the above example graph, in normal mode, StereoDepth would just get the max disparity = 34 pixels, but in Subpixel
mode, it will return a bit more, eg. 37.375 pixels, as confidences for pixels 35 and 36 are quite high as well.
mode, it will return a bit more, eg. 34.375 pixels, as confidences for pixels 35 and 36 are quite high as well.

**TL;DR:** Stereo Subpixel mode should always provide more accurate depth, but will consume additional HW resources (see :ref:`Stereo depth FPS` for impact).

Expand All @@ -287,7 +287,7 @@ Stereo subpixel effect on layering
Default stereo depth output has 0..95 disparity pixels, which would produce 96 unique depth values. This can especially be seen when using pointcloud representation
and seeing how there are discrete "layers" of points, instead of a smooth transition:

.. image:: /_static/images/components/layered-pointcloud.png
.. image:: /_static/images/components/pointcloud_layering.jpg

This layering can especially be seen at longer distances, where these layers are exponentially further apart.

Expand Down Expand Up @@ -375,7 +375,7 @@ as the other 2 methods above do.
Disparity shift will shift the starting point of the disparity search, which will significantly decrease MaxZ, but
it will also decrease the MinZ. Disparity shift can be combined with extended/subpixel/LR-check modes.

.. image:: https://user-images.githubusercontent.com/18037362/189375017-2fa137d2-ad6b-46de-8899-6304bbc6c9d7.png
.. image:: /_static/images/components/disparity_shift.png

The **Left graph** shows min and max disparity and depth for OAK-D (7.5cm baseline, 800P resolution, ~70° HFOV) by default (disparity shift=0). See :ref:`Depth from disparity`.
Since hardware (stereo block) has a fixed 95 pixel disparity search, DepthAI will search from 0 pixels (depth=INF) to 95 pixels (depth=71cm).
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/low-latency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Bandwidth

With large, unencoded frames, one can quickly saturate the bandwidth even at 30FPS, especially on PoE devices (1gbps link):

.. code-block::bash
.. code-block::
4K NV12/YUV420 frames: 3840 * 2160 * 1.5 * 30fps * 8bits = 3 gbps
1080P NV12/YUV420 frames: 1920 * 1080 * 1.5 * 30fps * 8bits = 747 mbps
Expand Down
40 changes: 40 additions & 0 deletions examples/Script/script_uart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
'''
NOTE: This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration!
'''
import depthai as dai
import time

# Start defining a pipeline
pipeline = dai.Pipeline()

script = pipeline.create(dai.node.Script)
script.setScript("""
import serial
import time
ser = serial.Serial("/dev/ttyS0", baudrate=115200)
i = 0
while True:
i += 1
time.sleep(0.1)
serString = f'TEST_{i}'
ser.write(serString.encode())
""")
# Define script for output
script.setProcessor(dai.ProcessorType.LEON_CSS)


config = dai.Device.Config()
# Get argument first
GPIO = dai.BoardConfig.GPIO
config.board.gpio[15] = GPIO(GPIO.OUTPUT, GPIO.ALT_MODE_2)
config.board.gpio[16] = GPIO(GPIO.INPUT, GPIO.ALT_MODE_2)
config.board.uart[0] = dai.BoardConfig.UART()


with dai.Device(config) as device:
device.startPipeline(pipeline)
print("Pipeline started")
while True:
time.sleep(1)

0 comments on commit 42d9f27

Please sign in to comment.