Script to improve Q...
 
Notifications
Clear all

Script to improve Q.bo's face tracking

11 Posts
4 Users
6 Reactions
1,657 Views
chrisbuy
(@chrisbuy)
Member
Joined: 6 years ago
Posts: 71
Topic starter  

For those interested in improving Q.bo's face detection and face  tracking, I've written a standalone script that allows testing purely vision of Q.bo. So don't expect yet with this script a fully working Q.bo (that will follow) but ideal for understanding Q.bo's thinking when it concerns face detection.

My base version uses the same HAAR cascade frontal and profile face detection of the original Q.bo code but I've optimized it, added face selection (the largest and closest to Q.bo) and finally the more CPU efficient face tracking once a face is detected.  But after a few seconds or so, it tries to redetect faces since there could be another face closer to Q.bo that might appear and would deserve/catch Q.bo's attention.

I had to resort to Python 3 in order to get the 'opencv-contrib-python' which is required for tracking.

  1. Connect to Q.bo using VNC
  2. Copy the attached file Qbo_face_detect_and_track.py to the /home/pi/ directory
  3. Press Ctrl+Alt+T to open a terminal
  4. Enter
    sudo pkill python
    sudo pkill chromium
  5. Enter
    sudo apt-get install libjasper-dev
    sudo apt-get install libqtgui4
    sudo apt-get install libqt4-test
    sudo pip3 install pyyaml
    sudo pip3 install imutils
    sudo pip3 install opencv-contrib-python
  6. Enter
    python3 Qbo_face_detect_and_track.py

A window appears named 'Video' showing what Q.bo actually realtime sees and where Q.bo detects and tracks faces. A detected and tracked face (each time only 1 face, the largest so closest to Q.bo) is surrounded by a green rectangle in the shown video window. Exit by pressing 'q'.

This topic was modified 6 years ago 2 times by chrisbuy

--
Christian Buysschaert
Leuven - Belgium
Email christian.buysschaert@gmail.com


   
Quote
Niko
 Niko
(@niko)
Eminent Member
Joined: 6 years ago
Posts: 39
 

I am creating a new PID and a robust face tracking for Q.bo using OpenCV. The next steps are to use the second camera for depth and object recognition. A lot of possibilities with this piece of hardware. We´ll be in touch!!!


   
ReplyQuote
chrisbuy
(@chrisbuy)
Member
Joined: 6 years ago
Posts: 71
Topic starter  

Looking forward to this and compare! Great to see others interested...

--
Christian Buysschaert
Leuven - Belgium
Email christian.buysschaert@gmail.com


   
ReplyQuote
(@romeo)
Member
Joined: 6 years ago
Posts: 76
 

did I do something wrong?

I get an error back: from .cv2 import*

ImportError: libhdf5_serial_so.100: cannot open shared object  file: No such file or directory

 


   
ReplyQuote
chrisbuy
(@chrisbuy)
Member
Joined: 6 years ago
Posts: 71
Topic starter  

Try ... specifically the instructions on libhdf5-serial-dev...

https://stackoverflow.com/questions/48965309/h5py-import-error-on-libhdf5-serial-so-100

--
Christian Buysschaert
Leuven - Belgium
Email christian.buysschaert@gmail.com


   
ReplyQuote
(@romeo)
Member
Joined: 6 years ago
Posts: 76
 

for opencv (3.4.4) I had to install:

sudo apt-get update
sudo apt-get install libhdf5-dev
sudo apt-get update
sudo apt-get install libhdf5-serial-dev

I tried to launch the program but I got a response like that:

Traceback (most recent call last):

File (Qbo_face_detect_and_track.py), line 119, in <module>

minisize=(30,30)

cv2.error: OpenCV(3.4.4) /home/pi/packaging/opencv-python/opencv/modules/objdetect/src/cascadedetect.cpp:1698:error: (-215:Assertion failed) !empty() in function 'detectMultiscale'.

and now?


   
ReplyQuote
chrisbuy
(@chrisbuy)
Member
Joined: 6 years ago
Posts: 71
Topic starter  

Do you have an /opt/qbo/haarcascades/ subdirectory?

pi@qbo:~ $ ls /opt/qbo/haarcascades/
haarcascade_frontalface_alt2.xml haarcascade_profileface_alt.xml
haarcascade_frontalface_default.xml haarcascade_profileface.xml
pi@qbo:~ $

--
Christian Buysschaert
Leuven - Belgium
Email christian.buysschaert@gmail.com


   
ReplyQuote
(@romeo)
Member
Joined: 6 years ago
Posts: 76
 

Sorry but I'm not very experienced ...

I think I have an incomplete installation of opencv because I do not have the directory:  /home/pi/packaging/opencv-python/opencv/modules/objdetect/src/...

the directory: /... / haarcascades / ... I created it manually

a suggestion?


   
ReplyQuote
chrisbuy
(@chrisbuy)
Member
Joined: 6 years ago
Posts: 71
Topic starter  

Ah, yes, you have a pre-Q.bo v3.0 installation (before everything was installed /home/pi/).

1. Copy the attached file to the (created) /opt/qbo/haarcascades/ directory

2. Unzip the file

unzip haarcascades.zip

3. Remove the file (for cleaning up purposes)

rm haarcascades.zip

4. Make sure the files are readable for everyone

chmod +r /opt/qbo/haarcascades

You should have then 4 .xml files in the directory which should allow you to proceed.

This post was modified 6 years ago by chrisbuy

--
Christian Buysschaert
Leuven - Belgium
Email christian.buysschaert@gmail.com


   
ReplyQuote
(@travid)
New Member
Joined: 6 years ago
Posts: 1
 

How does on get the Q.bo v3.0 beta?


   
ReplyQuote
Niko
 Niko
(@niko)
Eminent Member
Joined: 6 years ago
Posts: 39
 
Posted by: Travid

How does on get the Q.bo v3.0 beta?

i sent weeks ago an email to indiegogo@thecorpora.com in order to enter into the "beta programs". Don´t expect a quick answer because i know they are waiting for Mycroft "Open Voice Assistance" an agreement to use it in the new openQbo V3.0 Distro.


   
ReplyQuote
Share: