Hand Recognition and Finger Identification with Raspberry Pi and OpenCV

Hey Shirley,

Sorry for not getting to this! I don’t know why it didn’t pop up on my notifications. You could definitely use the PCA 9685 HAT with this system here, just take your time to completely understand how it operates inside Python Programming Language. Once you have that under wraps you’ll be able to port across the code controls into the Hand Recognition Script.

Those errors from your previous post have to do with leftover commands Specific to the Adafruit HAT. If you not using the Adafruit HAT and don’t change the script those errors will continue to pop up.

Hope that helps!
Tim

1 Like

Hey Mohith,

Double-check for me that you are operating with a Raspberry Pi 3+ or better and are running the older ‘Buster’ Raspberry Pi OS.

If you have both those sorted you will be good to go. Just make sure not to skip any of the commands and you’ll be smooth sailing.

Kind regards,
Tim

2 Likes

Is it possible to implement this project with Raspberry Pi Pico?

1 Like

Hey mate, I’ve seen low frame rate people detection with a Raspberry Pi Pico (Raspberry Pi Pico Person Detection with TinyML TensorFlow Lite - YouTube) but have yet to see any hand recognition/finger identification with a Pico. I’m sure at a very low frame rate that it’d be possible.

The computing ooomph that the Raspberry Pi 4 Model B Microprocessor brings to the table is crucial for running the system I have explored in this guide and it won’t run on the Raspberry Pi Pico Microcontroller as is.

1 Like

Hi. I am also having the same issue. The code runs without any error but does not track my hand.
Running the code on Buster with Python 3.7.3 and Opencv 4.5.5.

Face tracking code worked just fine. So, there is no problem with Picamera. I will really appreciate if someone can help.

Thanks & Regards,
Swagat

1 Like

Just wanted to provide an update here. The code is working without any problem. Initially, it was not working. However, it started working after a reboot. I think it was a false alarm. Please ignore my previous message. Thanks for this great tutorial.

2 Likes

Hey Swagat,

Happy days! Thank you for coming back and posting your success :slight_smile: Hope your project turns out super super swell.

Kind regards,
Tim

Hello, I get the following error:

**Traceback (most recent call last):**
**  File "/home/pi/Desktop/Pose.py", line 2, in <module>**
**    import mediapipe as mp**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/__init__.py", line 17, in <module>**
**    import mediapipe.python.solutions as solutions**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/python/solutions/__init__.py", line 17, in <module>**
**    import mediapipe.python.solutions.drawing_styles**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/python/solutions/drawing_styles.py", line 20, in <module>**
**    from mediapipe.python.solutions.drawing_utils import DrawingSpec**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/python/solutions/drawing_utils.py", line 25, in <module>**
**    from mediapipe.framework.formats import detection_pb2**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/framework/formats/detection_pb2.py", line 15, in <module>**
**    from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_location__data__pb2**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/framework/formats/location_data_pb2.py", line 15, in <module>**
**    from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterization__pb2**
**  File "/usr/local/lib/python3.7/dist-packages/mediapipe/framework/formats/annotation/rasterization_pb2.py", line 41, in <module>**
**    serialized_options=None, file=DESCRIPTOR),**
**  File "/usr/local/lib/python3.7/dist-packages/google/protobuf/descriptor.py", line 561, in __new__**
**    _message.Message._CheckCalledFromGeneratedFile()**
**TypeError: Descriptors cannot not be created directly.**
**If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.**
**If you cannot immediately regenerate your protos, some other possible workarounds are:**
** 1. Downgrade the protobuf package to 3.20.x or lower.**
** 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).**

**More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates**

I have followed all the steps and I still get this, I hope you can help me.

I have a question. I’ve followed the instructions as written, but when I type make -j $(nproc) I run into a snag. Namely, it gets stuck at “[100%] Built target example_tutorial_core_various”
Once it gets to this point, it just stalls out and refuses to continue. I left it on overnight and when I got back, it hadn’t budged in the slightest.
Any help would be appreciated.

Hey Mauricio,
It seems like you are using an incompatible version of the protobuf package. Try running the below command in your terminal:

pip install --upgrade protobuf

Let me know if that helps fix things.

Hey Wesley,

Its possible that you could troubleshoot the process by checking the log files that are produced when you run ‘make’. It might give you a better idea of exactly what has gone wrong there and if something catches your attention with it we can help debug and fix it with you.

Sometimes, the build process can get stuck because of old or corrupted build files. Try cleaning the build directory using the make clean command, and then try building the project again.

Cheers,
Blayden

me too the error is no module named mediapipe can any one help me thanks

Hey Shum,
Welcome to the forums!

It looks like your system is not finding MediaPipe when its looking to use/address it. Try the download steps again for MediaPipe as below:

sudo pip3 install mediapipe-rpi3
sudo pip3 install mediapipe-rpi4
sudo pip3 install gtts
sudo apt install mpg321

Once you have done that, continue with the steps in the guide to ensure everything is working correctly.

Cheers,
Blayden

Hello, whenever i run the code, i keep getting these error messages. I have tried so many different things but doesn’t seem to work. Its as if it doesn’t recognize mediapipe

Thank You

Hey Amir,

It looks like you may have a mix of issues there, the first one I would suggest going through is upgrading the Protobuff package using:
pip install --upgrade protobuf

Then running through the mediapipe commands as it seems mediapipe is causing a majority of those errors. You can do that with these commands:

sudo pip3 install mediapipe-rpi3
sudo pip3 install mediapipe-rpi4
sudo pip3 install gtts
sudo apt install mpg321

From there, I would keep following the guide and double checking you have matched the steps in the guide as they go along.

Cheers,
Blayden

Hi Blayden, I’m facing the same error. I’ve tried the steps and commands you suggested, still the error is not resolved. What should I do?

Hi Amir, I noticed you’re facing the same error. Did you resolve your error? If yes, can you suggest me the go-about.

Be careful with mixing pip and pip3
One manages Python2.7 and the other for Python3

Make sure to use pip3 for installing packages, and python3 for running scripts.