mediapipe
mediapipe copied to clipboard
So Sir i am building a virtual UI so can user travel to different script on virtual button distance becomes less??
Sir i am building a virtual UI so can user travel to different script on virtual button distance becomes less
System information (Please provide as much relevant information as possible)
- MediaPipe Solution (you are using):
- Programming language : C++/typescript/Python/Objective C/Android Java
- Are you willing to contribute it (Yes/No):
Currently i have implemented the UI watching ypur video but have to travel to other page on when the finger distance becomes small :
Hi @Omkarrr , Could you please elaborate this issue to investigate more on this.
`import cv2 from cvzone.HandTrackingModule import HandDetector cap = cv2.VideoCapture(0) cap.set(3, 1280) cap.set(4, 720)
detector = HandDetector(detectionCon=0.8, maxHands=2) keys = [["FaceAuth"],["LicenceAuth"],["Model_Aug"]]
def drawALL(img , buttonList): for button in buttonList: x, y = button.pos w, h = button.size cv2.rectangle(img, button.pos, (x + w, y + h), (255, 0, 255), cv2.FILLED) cv2.putText(img, button.text, (x + 45, y + 65), cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 5) return img
class Button(): def init(self, pos, text, size=[550, 80]): self.pos = pos self.text = text self.size = size
buttonList = [] for i in range(len(keys)): for j, key in enumerate(keys[i]): buttonList.append(Button([300 * j + 50, 100 * i + 50], key))
while True: success, img = cap.read() hands, img = detector.findHands(img) img = drawALL(img,buttonList) if hands: hand1 = hands[0] lmList1 = hand1["lmList"] bbox = hand1["bbox"]
for button in buttonList:
x, y = button.pos
w, h = button.size
if x < lmList1[8][0] < x + w and y < lmList1[8][1] < y + h:
cv2.rectangle(img, button.pos, (x + w, y + h), (175, 0, 175), cv2.FILLED)
cv2.putText(img, button.text, (x + 45, y + 65),
cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 5)
#l, _, _ = detector.findDistance(8, 12, img, draw=False)
#print(l)
p1=lmList1[8]
p2=lmList1[12]
length, info, img = detector.findDistance(p1, p2,img)
print(length)
if length<30:
cv2.rectangle(img, button.pos, (x + w, y + h), (0, 255, 0), cv2.FILLED)
cv2.putText(img, button.text, (x + 45, y + 65),
cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 5)
So I want to implement a gesture to run my python face detection module when length becomes less than 30
cv2.imshow("Image", img)
cv2.waitKey(1)
`
Hello @Omkarrr, Would you please let us know if you are still looking for resolution on issue or the issue has been resolved from your end? Thank you!
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
This issue was closed due to lack of activity after being marked stale for past 7 days.