mediapipe icon indicating copy to clipboard operation
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??

Open Omkarrr opened this issue 3 years ago • 2 comments

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 :

Omkarrr avatar Jul 12 '22 20:07 Omkarrr

Hi @Omkarrr , Could you please elaborate this issue to investigate more on this.

sureshdagooglecom avatar Jul 13 '22 05:07 sureshdagooglecom

`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)

`

Omkarrr avatar Jul 13 '22 13:07 Omkarrr

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!

kuaashish avatar May 29 '23 09:05 kuaashish

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.

github-actions[bot] avatar Jun 06 '23 02:06 github-actions[bot]

This issue was closed due to lack of activity after being marked stale for past 7 days.

github-actions[bot] avatar Jun 14 '23 01:06 github-actions[bot]