Camera Control with NN¶
This example shows how to set up control of color camera (focus and exposure) to be controlled by NN. The NN is a face detection model which passes detected face bounding box to camera component run auto focus and auto exposure algorithms on.
Note
Visualization in current example is done with blocking behavor. This means that the program will halt at oak.start()
until the window is closed.
This is done to keep the example simple. For more advanced usage, see Blocking behavior section.
Demo¶
Setup¶
Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai repository first and then run the script
git clone https://github.com/luxonis/depthai.git
cd depthai/
python3 install_requirements.py
For additional information, please follow our installation guide.
Pipeline¶
Source Code¶
Also available on GitHub
1 2 3 4 5 6 7 8 9 10 | from depthai_sdk import OakCamera with OakCamera() as oak: color = oak.create_camera('color') face_det = oak.create_nn('face-detection-retail-0004', color) # Control the camera's exposure/focus based on the (largest) detected face color.control_with_nn(face_det, auto_focus=True, auto_exposure=True, debug=False) oak.visualize(face_det, fps=True) oak.start(blocking=True) |