Guide by Tim; Integrated Computer Vision Package - OAK-D Lite With Raspberry Pi Set Up

I have just shared content in Guides > Raspberry Pi: “Integrated Computer Vision Package - OAK-D Lite With Raspberry Pi Set Up”





Read more

4 Likes

Awesome guide Tim!
It’s just a little bit creepy that neural networks mean that cameras can now read my pulse by looking at me across the room, big Terminator vibes!

3 Likes

Hi
Having Issues trying to install pyside2.
Installed latest Raspian on a 32GB card
Rasp Pi 4 running: “Raspbian GNU/Linux 11 (bullseye)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“11”
Python version 3.9.2
sudo git clone GitHub - luxonis/depthai: DepthAI Python API utilities, examples, and tutorials. – downloads ok
cd depthai
sudo python3 install_requirements.py

ERROR: Could not find a version that satisfies the requirement PySide2 (from depthai-sdk) (from versions: none)
ERROR: No matching distribution found for PySide2

Has anyone else received this error? Please advise

1 Like

Welcome Peter!

If you manually install PySide2 do the rest of the packages install?
Try running
pip install PySide2

Hi Liam, thanks for the suggestion. Ive tried both pip & pip3:
pip install PySide2
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: Simple index, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement PySide2 (from ver sions: none)
ERROR: No matching distribution found for PySide2

1 Like

Hey Peter,

I just learned that you can install PySide2 without using Pip. It is probably the largest terminal command I’ve ever seen. Type and Enter the following into a New Terminal Window -

sudo apt-get install python3-pyside2.qt3dcore python3-pyside2.qt3dinput python3-pyside2.qt3dlogic python3-pyside2.qt3drender python3-pyside2.qtcharts python3-pyside2.qtconcurrent python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qthelp python3-pyside2.qtlocation python3-pyside2.qtmultimedia python3-pyside2.qtmultimediawidgets python3-pyside2.qtnetwork python3-pyside2.qtopengl python3-pyside2.qtpositioning python3-pyside2.qtprintsupport python3-pyside2.qtqml python3-pyside2.qtquick python3-pyside2.qtquickwidgets python3-pyside2.qtscript python3-pyside2.qtscripttools python3-pyside2.qtsensors python3-pyside2.qtsql python3-pyside2.qtsvg python3-pyside2.qttest python3-pyside2.qttexttospeech python3-pyside2.qtuitools python3-pyside2.qtwebchannel python3-pyside2.qtwebsockets python3-pyside2.qtwidgets python3-pyside2.qtx11extras python3-pyside2.qtxml python3-pyside2.qtxmlpatterns python3-pyside2uic

Above is a pretty hail-mary approach but with that done successfully you should have everything you need :blush: If the above doesn’t work out I’ll pull out the OAK-D Lite we have here and completely run through the install process to check everything.

Kindest regards,
Tim

1 Like

Hi Tim, thanks for your suggestion. I had already found this suggestion. New error being: Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package python3-pyside2uic

Hey Peter,

Have replicated the error over here as well. It seems to come down to libraries not getting updated (in particular PySide2) for the newest release of the GUI system that Luxonis has created/recent Python updates. If you were to ignore that PySide2 issue and continued forth you would still be able to run all the Scripts explored here. The only aspect we are locked out from is the GUI Demo Program.

There are alternative ways to get the GUI Demo Program onto your system, so if you really want this feature, you can find how to set it up here - GitHub - luxonis/depthai: DepthAI Python API utilities, examples, and tutorials.

Give the team at Luxonis and PySide2 a couple of days and I reckon this PySide2 issue will be cleared up. The methods we have been going about should work as per the PyPi website (but clearly dont) - PySide2 · PyPI - So its only a matter of time untill that goes back to normal.

Hopefully this helps some, I will keep my thinking hat on and the second I have a better solution I’ll write it up.

Kind regards,
Tim

2 Likes

Just found this in regards to pyside2uic which might be worth a go

The pyside2-uic file is provided by the pyside2-tools package from the PPA you gave. Therefore, you install pyside2-tools using:

sudo apt-get install pyside2-tools
1 Like

Hi Tim, this works to install pyside2-uic. Woo hoo.
The next challenge is around executing the heartrate estimation. Sorry
Executing the main.py,
Error File "/home/pi/heartrate_estimation/heartrate_estimator.py"line 51 in init
self.ft = cv2.freetype.createFreeType2()
Attribute error: module çv2’has no attribute ‘freetype’
pip list includes the following:
opencv-contrib-python 4.6.0.66
opencv-python 4.6.0.66
So,
python3
import cv2
cv2.getBuildInformation()
looks like freetype is disabled: (See attached results from getBuildInformation())

'\nGeneral configuration for OpenCV 4.6.0 =====================================\n  Version control:               unknown\n\n  Extra modules:\n    Location (extra):            /tmp/pip-install-z5prllx2/opencv-contrib-python_2b6b88af5c664317b019c8440ddc3ef6/opencv_contrib/modules\n    Version control (extra):     unknown\n\n  Platform:\n    Timestamp:                   2022-11-07T22:54:59Z\n    Host:                        Linux 5.15.61-v7l+ armv7l\n    CMake:                       3.24.3\n    CMake generator:             Unix Makefiles\n    CMake build tool:            /usr/bin/gmake\n    Configuration:               Release\n\n  CPU/HW features:\n    Baseline:\n      requested:                 DETECT\n\n  C/C++:\n    Built as dynamic libs?:      NO\n    C++ standard:                11\n    C++ Compiler:                /usr/bin/c++  (ver 10.2.1)\n    C++ flags (Release):         -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG\n    C++ flags (Debug):           -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG\n    C Compiler:                  /usr/bin/cc\n    C flags (Release):           -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG\n    C flags (Debug):             -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG\n    Linker flags (Release):      -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined  \n    Linker flags (Debug):        -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined  \n    ccache:                      NO\n    Precompiled headers:         NO\n    Extra dependencies:          /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/arm-linux-gnueabihf/libpng.so /usr/lib/arm-linux-gnueabihf/libtiff.so /usr/lib/arm-linux-gnueabihf/hdf5/serial/libhdf5.so /usr/lib/arm-linux-gnueabihf/libpthread.so /usr/lib/arm-linux-gnueabihf/libsz.so /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/arm-linux-gnueabihf/libdl.so /usr/lib/arm-linux-gnueabihf/libm.so Iconv::Iconv dl m pthread rt\n    3rdparty dependencies:       libprotobuf ade ittnotify libwebp libopenjp2 IlmImf quirc\n\n  OpenCV modules:\n    To be built:                 aruco barcode bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto\n    Disabled:                    freetype world\n    Disabled by dependency:      -\n    Unavailable:                 alphamat cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java julia matlab ovis python2 sfm ts viz\n    Applications:                -\n    Documentation:               NO\n    Non-free algorithms:         NO\n\n  GUI:                           GTK2\n    GTK+:                        YES (ver 2.24.33)\n      GThread :                  YES (ver 2.66.8)\n      GtkGlExt:                  NO\n    VTK support:                 NO\n\n  Media I/O: \n    ZLib:                        /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.11)\n    JPEG:                        /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver 62)\n    WEBP:                        build (ver encoder: 0x020f)\n    PNG:                         /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.37)\n    TIFF:                        /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.2.0)\n    JPEG 2000:                   build (ver 2.4.0)\n    OpenEXR:                     build (ver 2.3.0)\n    HDR:                         YES\n    SUNRASTER:                   YES\n    PXM:                         YES\n    PFM:                         YES\n\n  Video I/O:\n    DC1394:                      YES (2.2.6)\n    FFMPEG:                      YES\n      avcodec:                   YES (58.91.100)\n      avformat:                  YES (58.45.100)\n      avutil:                    YES (56.51.100)\n      swscale:                   YES (5.7.100)\n      avresample:                NO\n    GStreamer:                   NO\n    v4l/v4l2:                    YES (linux/videodev2.h)\n\n  Parallel framework:            pthreads\n\n  Trace:                         YES (with Intel ITT)\n\n  Other third-party libraries:\n    Lapack:                      NO\n    Eigen:                       NO\n    Custom HAL:                  NO\n    Protobuf:                    build (3.19.1)\n\n  OpenCL:                        YES (no extra features)\n    Include path:                /tmp/pip-install-z5prllx2/opencv-contrib-python_2b6b88af5c664317b019c8440ddc3ef6/opencv/3rdparty/include/opencl/1.2\n    Link libraries:              Dynamic load\n\n  Python 3:\n    Interpreter:                 /usr/bin/python3 (ver 3.9.2)\n    Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython3.9.so (ver 3.9.2)\n    numpy:                       /tmp/pip-build-env-uoqkxm_k/overlay/lib/python3.9/site-packages/numpy/core/include (ver 1.19.3)\n    install path:                python/cv2/python-3\n\n  Python (for build):            /usr/bin/python3\n\n  Java:                          \n    ant:                         NO\n    JNI:                         NO\n    Java wrappers:               NO\n    Java tests:                  NO\n\n  Install to:                    /tmp/pip-install-z5prllx2/opencv-contrib-python_2b6b88af5c664317b019c8440ddc3ef6/_skbuild/linux-armv7l-3.9/cmake-install\n-----------------------------------------------------------------\n\n'
2 Likes

Heyya mate,

Glad you figured out that last hurdle :blush: so let’s tackle this new one now too! Freetype has to do text displaying with OpenCV-created windows.

The official GitHub for the Cortic Heartrate Monitoring Script can be located here -GitHub - cortictechnology/heartrate_estimation: Vision-based heart rate estimation using OAK-D camera - They recommend/run their version to directly run the script from a new Terminal Window. That and trying to run the script using a Sudo Thonny IDE and a Normal Privelledges Default Thonny IDE version would also be worthwhile and quick experiments.

If none of that works then my first step would be to run through these three terminal commands fround at that Cortic GitHub page

cd heartrate_estimation
bash install_dependencies.sh

Hopefully, that gets us a step closer to success.

2 Likes

Hi Tim,
Looking at the cortictechnology git hub repo a bit further, a bug has been raised about this error: install_dependencies error · Issue #3 · cortictechnology/heartrate_estimation · GitHub. Its around the version of opencv packaged with freetype. The heartrate_estimation requirements.txt lists opencv-contrib-python==4.1.0.25.

  1. the opencv-contrib-python version is no longer available. (it looks like it included the freetype). - pip install opencv-contrib-python==4.1.0.25 returns the error:
    ERROR: Could not find a version that satisfies the requirement opencv-contrib-python==4.1.0.25 (from versions: 3.4.8.29, 3.4.9.31, 3.4.9.33, 3.4.10.35, 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.14.51, 3.4.14.53, 3.4.15.55, 3.4.16.59, 3.4.17.61, 3.4.17.63, 3.4.18.65, 4.1.2.30, 4.2.0.32, 4.2.0.34, 4.3.0.36, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.2.52, 4.5.2.54, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64, 4.6.0.66)
    ERROR: No matching distribution found for opencv-contrib-python==4.1.0.25
  2. opencv-contrib-python does not come with freetype packaged as standard. You can check with
    import cv2
    cv2.getBuildInformation().
  3. Looks like we use CMAKE / Build a version of the opencv package to include freetype: See: https://www.modb.pro/db/542979

Regards

Peter

2 Likes

Hi Tim,
To get the heartrate monitor working you have to build a version on the raspberry pi of opencv with freetype packaged in with it.

3 Likes

Hey Peter,

There has been an update on their side and now all the terminal commands as written in my guide work as they should :blush: I ran through it just this morning and everything is as it should be. Hope that brings some cheer to your day the same as mine.

Kind regards,
Tim

2 Likes

Thanks for the update Tim

2 Likes

Hello Tim,

great video and great guide. I am going to order an OAK-D Lite myself - which type would you recommend: Fixed-Focus or Auto-Focus. Seems to me that Fixed-Focus version supports a wider range of utilization (e.g., on drones or cars). Any thoughts from your side?

Cheers, Tom

1 Like

Heyya Tom,

My preference has to be the auto-focusing Oak-D Lite I used for this guide. I just love the way it snaps to people’s faces/never leaves the system confused with blurry images. Know that you can always disable the auto-focusing inside the programming script, so I do think the auto-focusing Oak-D Lite Camera is the superior of the two systems.

This is a great video that dives into it further - Auto Focus (AF; upper-left) vs. Fixed Focus (FF; bottom-right) variants of OAK-D-Lite - YouTube - Luxonis do recommend in high vibration situations (like mounted to a drone) the Fixed Focus will be a better fit.

Just my 2 pennies and kind regards,
Tim

2 Likes

Hi,
I’m using Raspbian GNU/Linux version 11 on my Raspberry Pi 4 und I just tried to set up

OAK-D Lite like in the following article.

The first problem is that after the first command from the articele no Video Preview window pops up and further on no Graphical User Interface opens when I countinue the installation process.
The depthai-experiments/gen2-blur-faces and other experiments are working after the installation process but when I’ve a Phyton code like:
import depthai
from depthai_sdk import OakCamera

I also get the error "cannot import name ‘OakCamera’ from ‘depthai_sdk’ "

Please help me.

Best regards,
Gerald

Hi -

Very nice, well done tutorial … thanks. I’ve not had much trouble following along and getting things running on an RPi 4 (32-bit Bullseye) with my Oak-D … but am simply not seeing the depthai GUI when running depthai_demo.py … all I am getting are the color and disparity color windows - see attached screen capture. (Things work as expected if running this script on my Mac … the GUI is fine).

This Luxonis discussion suggests that the issue may be related to the program defaulting to the openCV vs. QT GUI, however offers no suggestions or resolution.

I’d be interested in knowing if there may be something I might have overlooked, or if there is a way to get the depthai_demo GUI running on the Pi as indicated in the tutorial.

Thanks in advance,
Larry