Skip to content

Commit

Permalink
Merge pull request #304 from luxonis/fov_tutorial
Browse files Browse the repository at this point in the history
Added maximizing FoV docs
  • Loading branch information
Erol444 committed Jul 14, 2021
2 parents 95652c8 + edeb0a5 commit 3bf1962
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Binary file added docs/source/_static/images/tutorials/fov.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Now, pick a tutorial or code sample and start utilizing Gen2 capabilities
tutorials/hello_world.rst
tutorials/multiple.rst
tutorials/local_convert_openvino.rst
tutorials/maximize_fov.rst

.. toctree::
:maxdepth: 1
Expand Down
32 changes: 32 additions & 0 deletions docs/source/tutorials/maximize_fov.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
How to maximize FOV
===================

By default, when you are using :code:`preview` output from :ref:`ColorCamera`, the DepthAI will crop the
frames to get the desired aspect ratio. For example, if you are using Mobilenet-SSD model, you need
:code:`300x300` frames. DepthAI will crop 1080P frames to :code:`1080x1080` and then resize them to :code:`300x300`.
This means you will lose some part of the image.

If you would like to maximize the FOV of the image, you can either:

#. Change the aspect ratio (stretch the image)
#. Apply letterboxing to the image

Change aspect ratio
*******************

Use :code:`camRgb.setPreviewKeepAspectRatio(False)`. This means the aspect ratio will not be preserved and the image
will be "stretched". This might be problematic for some off-the-shelf NN models, so model fine-tuning it might be required.
`Usage example here <https://github.com/luxonis/depthai-python/blob/main/examples/rgb_mobilenet_4k.py#L42>`__.

Letterboxing
************

`Letterboxing <https://en.wikipedia.org/wiki/Letterboxing_%28filming%29>`__ the frames. This method will decrease
the size of the image and apply "black bars" above and below the image, so the aspect ratio is preserved. You can
achieve this by using :ref:`ImageManip` with :code:`manip.setResizeThumbnail(x,y)` (for Mobilenet :code:`x=300,y=300`).
The downside of using this method is that your actual image will be smaller, so some features might not be preserved,
which can mean the NN accuracy could decrease.
`Usage example here <https://github.com/luxonis/depthai-python/blob/main/examples/object_tracker_video.py#L44>`__.

.. image:: /_static/images/tutorials/fov.jpeg

0 comments on commit 3bf1962

Please sign in to comment.