I am currently working with tkinter, opencv and Media Pipe Framework.I want to recognise all 21 positions of my hands with a JPG image file of myself (Here you can find more information about Mediapipe: https://google.github.io/mediapipe/solutions/holistic).
With the help of Tkinter I can call up my picture and play it back. But how can I make my hands recognisable through the Mediapipe? I am currently trying to work with the holistic method of Mediapipe, as I would then also like to identify my face and body.
Unfortunately, I get the following error message with my implementation:
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:/Users/AR/projects/pro1/pictureMp.py", line 51, in visual()
File "C:/Users/AR/projects/pro1/pictureMp.py", line 37, in visual
panelA = Label(image=image)
File "C:\Python\Python37\lib\tkinter\__init__.py", line 2766, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "C:\Python\Python37\lib\tkinter\__init__.py", line 2299, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "[[[186 195 169]... There are more matrices like this... " doesn't exist
This here is my code. I Hope you can help me.
def detection(image, model):
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
results = model.process(image)
return image, results
def landmarks(image, results):
mpDraw.draw_landmarks(image, results.left_hand_landmarks, mpHolistic.HAND_CONNECTIONS)
mpDraw.draw_landmarks(image, results.right_hand_landmarks, mpHolistic.HAND_CONNECTIONS)
def visual():
global panelA
with mpHolistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:
image = cv2.imread(pathF.path)
image, results = detection(image, holistic)
landmarks(image, results)
if panelA is None:
panelA = Label(image=image)
panelA.image = image
panelA.pack(side="left", padx=10, pady=10)
else:
panelA.configure(image=image)
panelA.image = image
def image():
global cap
pathF.path = filedialog.askopenfilename()
filename = os.path.basename(pathF.path)
if len(select_image.path) > 0:
cap = cv2.imread(pathF.path)
visualize()