I found your guide titled “Building a Raspberry Pi Pan/Tilt Face Tracker” while doing some research online. In the guide you use a PWM servo driver from Adafruit instead of your new Pan Tilt HAT. I currently have the 16 servo PWM HAT which I need for animating a robotic face. When I tried to follow the guide I realized that the files at git clone https://github.com/pimoroni/PanTiltFacetracker had changed and the file facetracker.py had turned to facetracker_lbp.py. When I tried to run the code I got and import error for pantilthat library. Do you need the official Pan Tilt HAT board for this to work, or do I have some kind of install error?
I’ve tagged the original Adafruit PWM code for you, you should be able to get it here: https://github.com/pimoroni/PanTiltFacetracker/tree/AdafruitPWM
git clone https://github.com/pimoroni/PanTiltFacetracker -b AdafruitPWM
Thank you so much. I can’t wait to try it out. I will let you know how it
Terrence J. Martin
Science Dept., Physics
William Howard Taft High School
210-397-6000 ext. 3333
Do you know which version of opencv this was using. I am getting the following
Frame rate set to 7.500 fps
Traceback (most recent call last):
File “facetracker.py”, line 29, in
AttributeError: ‘module’ object has no attribute ‘cv’
I was doing research and it appears this is from trying to use code written for opencv2 with opencv3 install. Am I way off the mark?
Thanks for your time!
That’s a good question- I’m not even close to being an authority on OpenCV and never checked the version number of what I happened to be using. Sounds plausible though.
It looks like the updated code might be:
That was part of the problem. My path to the cascade was also wrong, and a few other tid bits. Probably should have started with something easier as my first attempt at Python, but I never was one to give up just because it looks difficult. Guess that is why they call it a hobbie. If it worked the first time I would have nothing to do… Anyway, I wanted to thank you, and when I get all the bugs worked out I will post the code. I can say however it is now working and the robot head is creeping out my students as it follows them around. Exactly what I was hoping for!
That’s the spirit :D Dive in the deep end and learn via the liberal application of sheer determination.
Gad you got it up and running. And… yeah… even without any attempt to make it look creepy, a plain pan/tilt setup is really unnerving when it follows your face around.