Esempio n. 1
0
# capture the hand histogram by placing your hand in the box shown and
# press 'A' to confirm
# source is set to inbuilt webcam by default. Pass source=1 to use an
# external camera.
hist = handy.capture_histogram(source=0)

while True:
    ret, frame = cap.read()
    if not ret:
        break

    # to block a faces in the video stream, set block=True.
    # if you just want to detect the faces, set block=False
    # if you do not want to do anything with faces, remove this line
    handy.detect_face(frame, block=True)

    # detect the hand
    hand = handy.detect_hand(frame, hist)

    # to get the outline of the hand
    # min area of the hand to be detected = 10000 by default
    custom_outline = hand.draw_outline(
        min_area=10000000, color=(0, 255, 255), thickness=2)

    # to get a quick outline of the hand
    quick_outline = hand.outline

    # draw fingertips on the outline of the hand, with radius 5 and color red,
    # filled in.
    for fingertip in hand.fingertips:
Esempio n. 2
0
import handy
import cv2

cap = cv2.VideoCapture(0)

# capture the hand histogram by placing your hand in the box shown and
# press 'A' to confirm
hist = handy.capture_histogram(source=0)

while True:
    ret, frame = cap.read()
    if not ret:

        break

    handy.detect_face(frame, block=False)

    # detect the hand
    hand = handy.detect_hand(frame, hist)

    # to get the outline of the hand
    custom_outline = hand.draw_outline(min_area=10000,
                                       color=(0, 255, 255),
                                       thickness=2)

    # to get a quick outline of the hand
    quick_outline = hand.outline

    # draw fingertips on the outline of the hand, with radius 5 and color red,
    # filled in.
    for fingertip in hand.fingertips:
Esempio n. 3
0
# capture the hand histogram by placing your hand in the box shown and
# press 'A' to confirm
# source is set to inbuilt webcam by default. Pass source=1 to use an
# external camera.
hist = handy.capture_histogram(0)

while True:
    ret, frame = cap.read()
    if not ret:
        break

    # to block a faces in the video stream, set block=True.
    # if you just want to detect the faces, set block=False
    # if you do not want to do anything with faces, remove this line
    handy.detect_face(frame, True)

    # detect the hand
    hand = handy.detect_hand(frame, hist)

    # to get the outline of the hand
    # min area of the hand to be detected = 10000 by default
    custom_outline = hand.draw_outline(10000,(0, 255, 255), 2)

    # to get a quick outline of the hand
    quick_outline = hand.outline

    # draw fingertips on the outline of the hand, with radius 5 and color red,
    # filled in.
    for fingertip in hand.fingertips:
        cv2.circle(quick_outline, fingertip, 5, (0, 0, 255), -1)
Esempio n. 4
0
fire, screen = cap.read()
hand = handy.detect_hand(screen, hist)
com = hand.get_center_of_mass()

resetTime = 0
prevStatey = com[0]
prevStatex = com[1]

while True:
    fire, screen = cap.read()
    if not fire:
        break
    # to block a faces in the video stream, set block=True.
    # if you just want to detect the faces, set block=False
    # if you do not want to do anything with faces, remove this line
    handy.detect_face(screen, block=True)
    # detect the hand
    hand = handy.detect_hand(screen, hist)
    # to get the outline of the hand
    # min area of the hand to be detected = 10000 by default
    custom_outline = hand.draw_outline(min_area=10000,
                                       color=(0, 255, 255),
                                       thickness=2)
    # to get a quick outline of the hand
    quick_outline = hand.outline
    # draw fingertips on the outline of the hand, with radius 5 and color red,
    # filled in.

    for fingertip in hand.fingertips:
        cv2.circle(quick_outline, fingertip, 5, (0, 0, 255), -1)
        cv2.circle(quick_outline, (300, 250), 50, (255, 0, 0), 2)