SunFounder PiDog Kit, Release 1.0
2.2.8 Face Track
PiDog will sit quietly in place. You applaud it, it looks your way, and if it sees you, it says hello.
Run the Code
cd
/
home
/
pi
/
pidog
/
examples
sudo python3
7
_face_track
.
py
After running this code, PiDog will start the camera and enable the face detection function. You can visit
http://
+ PiDog's IP +/mjpg
(like mine is
http://192.168.18.138:9000/mjpg
) in your browser to view the
camera’s picture.
Then PiDog will sit down and activate the Sound Direction Sensor Module to detect the direction of your clapping.
When PiDog hears clapping (or other noise), it turns its head toward the sound source, trying to find you.
If it sees you (face detection finds an object), it will wag its tail and let out a bark.
Code
Note:
You can
Modify/Reset/Copy/Run/Stop
the code below. But before that, you need to go to source code path
like
pidog\examples
. After modifying the code, you can run it directly to see the effect.
#!/usr/bin/env python3
from
pidog
import
Pidog
from
time
import
sleep
from
vilib
import
Vilib
(continues on next page)
58
Chapter 2. Play with Python
Summary of Contents for PiDog
Page 1: ...SunFounder PiDog Kit Release 1 0 sunfounder Jan 09 2023 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder PiDog Kit Release 1 0 Content 2 CONTENTS ...
Page 8: ...SunFounder PiDog Kit Release 1 0 4 Chapter 1 Component List and Assembly Instructions ...
Page 15: ...SunFounder PiDog Kit Release 1 0 Step 7 Click the WRITE button 2 1 Quick Guide on Python 11 ...
Page 92: ...SunFounder PiDog Kit Release 1 0 88 Chapter 2 Play with Python ...
Page 108: ...SunFounder PiDog Kit Release 1 0 104 Chapter 4 Appendix ...