Skip to content

Commit 3bf1962

Browse files
authored
Merge pull request #304 from luxonis/fov_tutorial
Added maximizing FoV docs
2 parents 95652c8 + edeb0a5 commit 3bf1962

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
233 KB
Loading

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Now, pick a tutorial or code sample and start utilizing Gen2 capabilities
7878
tutorials/hello_world.rst
7979
tutorials/multiple.rst
8080
tutorials/local_convert_openvino.rst
81+
tutorials/maximize_fov.rst
8182

8283
.. toctree::
8384
:maxdepth: 1
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
How to maximize FOV
2+
===================
3+
4+
By default, when you are using :code:`preview` output from :ref:`ColorCamera`, the DepthAI will crop the
5+
frames to get the desired aspect ratio. For example, if you are using Mobilenet-SSD model, you need
6+
:code:`300x300` frames. DepthAI will crop 1080P frames to :code:`1080x1080` and then resize them to :code:`300x300`.
7+
This means you will lose some part of the image.
8+
9+
If you would like to maximize the FOV of the image, you can either:
10+
11+
#. Change the aspect ratio (stretch the image)
12+
#. Apply letterboxing to the image
13+
14+
Change aspect ratio
15+
*******************
16+
17+
Use :code:`camRgb.setPreviewKeepAspectRatio(False)`. This means the aspect ratio will not be preserved and the image
18+
will be "stretched". This might be problematic for some off-the-shelf NN models, so model fine-tuning it might be required.
19+
`Usage example here <https://github.com/luxonis/depthai-python/blob/main/examples/rgb_mobilenet_4k.py#L42>`__.
20+
21+
Letterboxing
22+
************
23+
24+
`Letterboxing <https://en.wikipedia.org/wiki/Letterboxing_%28filming%29>`__ the frames. This method will decrease
25+
the size of the image and apply "black bars" above and below the image, so the aspect ratio is preserved. You can
26+
achieve this by using :ref:`ImageManip` with :code:`manip.setResizeThumbnail(x,y)` (for Mobilenet :code:`x=300,y=300`).
27+
The downside of using this method is that your actual image will be smaller, so some features might not be preserved,
28+
which can mean the NN accuracy could decrease.
29+
`Usage example here <https://github.com/luxonis/depthai-python/blob/main/examples/object_tracker_video.py#L44>`__.
30+
31+
.. image:: /_static/images/tutorials/fov.jpeg
32+

0 commit comments

Comments
 (0)