Script to experimen...
 
Notifications
Clear all

Script to experiment Q.bo's face tracking and following

3 Posts
3 Users
0 Reactions
1,051 Views
chrisbuy
(@chrisbuy)
Member
Joined: 6 years ago
Posts: 71
Topic starter  

 

Here I am again... the same script for Q.bo's improved face detection but now with an attempt to follow the (moving) face with his head! I've put in several alternatives and parameters to tweak and play with.

It is again a standalone script that allows testing purely vision and head movement of Q.bo but it requires a (beta) version of OpenQbo v3.0. But again, it is just detecting a face and trying to follow it. Apart from the nose that changes color once a face is detected, Q.bo is basically only trying to move his head to follow the (moving) face AND it will report so by displaying what direction his head needs to go to (left, right, up, down) when showing the detected face in the window!

This version uses again the same HAAR cascade frontal and profile face detection of the original Q.bo code and the cv2's CSRT tracker (although feel free to play around with the other trackers) when a face was detected for optimization.  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' working 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_follow.py

A window appears named 'Video' showing what Q.bo actually realtime sees and where Q.bo detects and follows faces. A detected and followed 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'.

NOTE 1: PLEASE NOTE SINCE YOU WILL BE VIEWING EXACTLY WHAT Q.BO IS SEEING 'REALTIME', IT IS VERY SLOW! (1 FRAME PER SECOND OR SO) NORMALLY Q.BO DOESN'T HAVE TO DO ALL THAT EXTRA PROCESSING. IT IS JUST FUN TO SEE HOW Q.BO SEES/THINKS.

NOTE 2: AFTER A FEW MINUTES, I AM EXPERIENCING LOSS OF CONTROL OF THE UP/DOWN MOVEMENT OF THE HEAD. THIS IS DUE TO AN ERROR IN THE ARDUINO CODE (WHICH STILL NEEDS TO BE FIXED).

This topic was modified 6 years ago by chrisbuy

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


   
Quote
(@daragon14)
New Member
Joined: 2 years ago
Posts: 2
 

So i was trying to run this python file, and to run it i needed to install some libraries like this "sudo apt-get install libjasper-dev" but gets me a error "E: dpkg was interrupted, you must mannually run 'sudo dpkg --configure - a' to correct the problem ", so i run that command but everything stopped working. So i want to know how to resolve this issue


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

Qbo and Ghat GPT4
I am happy to announce that Q.Bo Stem, but also the Q.BO One version, without touch screen, can use the artificial ket GPT intelligence, with an appropriate update.
The use of Python3 (version 3.7 or higher), the Raspbian Buster operating system and a series of bookstores specially installed to give the chance to Q.BO to express itself in many languages is necessary.
In this regard, the "Robotics in Education" paper "text is available, at the moment in the English version (Amazon.com) and in the Italian version (Amazon.it), but soon also in the Portuguese, French and Spanish versions.
Link:
https://www.amazon.com/ROBOTICS-EDUCATION-CODING-English-version/dp/B0BRMT29KC/ref=sr_1_2?qid=1678982556&refinements=p_27%3ARomeo&s=books&sr=1-2
(ISBN-13 - 979-8372562745)

https://www.amazon.it/ROBOTICS-EDUCATION-Q-BO-CODING-STEM/dp/B0BCS36XHM

(ISBN-13- 979-8849977416)

It is possible to see some performances of Q.BO STEM at these sites:
https://www.youtube.com/playlist?list=PLeK5UVm7TTbYETUwOMdrXbcyv9ftrG9_V
https://www.tiktok.com/@qbo_robot
https://www.instagram.com/romeo_ceccato/
https://www.facebook.com/groups/114831101881687

I remain at your disposal for more information about it and thank you for your kind attention.


   
ReplyQuote
Share: