Closed ruadoVn closed 2 years ago
Because Hand's init method now has 5 params (see https://github.com/google/mediapipe/blob/master/mediapipe/python/solutions/hands.py#L89) and the third parameter is model_complexity, which is an int. Please modify your code accordingly.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.
python 3.10
mediapipe : 0.8.9.1
Same result :
D:\Pycharm-Projects\venv\Scripts\python.exe D:/Pycharm-Projects/Opencv-Sample/020-HandDetectionGame.py
Traceback (most recent call last):
File "D:\Pycharm-Projects\Opencv-Sample\020-HandDetectionGame.py", line 9, in
Invoked with: 0.5 [ WARN:0@2.635] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (539) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
Please make sure that this is a bug and also refer to the troubleshooting, FAQ documentation before raising any issues.
System information (Please provide as much relevant information as possible)
Describe the current behavior: The program wont work and this the log Traceback (most recent call last): File "/run/media/ruadovn/CODE/Python/SoundControl/test.py", line 16, in
detector=htm.handDetector(detectionCon=0.55)
File "/run/media/ruadovn/CODE/Python/SoundControl/hand.py", line 19, in init
self.hands = self.mpHands.Hands(self.mode, self.maxHands,
File "/run/media/ruadovn/CODE/Python/SoundControl/venv3.9/lib/python3.9/site-packages/mediapipe/python/solutions/hands.py", line 114, in init
super().init(
File "/run/media/ruadovn/CODE/Python/SoundControl/venv3.9/lib/python3.9/site-packages/mediapipe/python/solution_base.py", line 258, in init
self._input_side_packets = {
File "/run/media/ruadovn/CODE/Python/SoundControl/venv3.9/lib/python3.9/site-packages/mediapipe/python/solution_base.py", line 259, in
name: self._make_packet(self._side_input_type_info[name], data)
File "/run/media/ruadovn/CODE/Python/SoundControl/venv3.9/lib/python3.9/site-packages/mediapipe/python/solution_base.py", line 513, in _make_packet
return getattr(packetcreator, 'create' + packet_data_type.value)(data)
TypeError: create_int(): incompatible function arguments. The following argument types are supported:
Invoked with: 0.55 Describe the expected behavior: The program must run Standalone code to reproduce the issue: Provide a reproducible test case that is the bare minimum necessary to replicate the problem. If possible, please share a link to Colab/repo link /any notebook: """ Hand Module
"""
import cv2 import mediapipe as mp import time
class handDetector(): def init(self, mode=False, maxHands=2, detectionCon=0.5, trackCon=0.5): self.mode = mode self.maxHands = maxHands self.detectionCon = detectionCon self.trackCon = trackCon
def main(): pTime = 0 cTime = 0 cap = cv2.VideoCapture(1) detector = handDetector() while True: success, img = cap.read() img = detector.findHands(img) lmList = detector.findPosition(img) if len(lmList) != 0: print(lmList[4])
if name == "main": main() Other info / Complete Logs : Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached