Beispiel #1
0
def main(frame):
    # Get the guitar model
    guitar = guitarmodel.get_guitar(frame)

    # Return unchanged frame if no guitar
    if not guitar:
        return frame

    # Get the hands (list of fingertips) in the frame
    (pickhand, frethand) = get_hands(frame, guitar)

    # Print for debugging and testing purposes
    sys.stderr.write(errorstring.format(list(pickhand), list(frethand)))

    # Add overlay circles on fingers for display
    frame = utils.addrectangle(frame, pickhand_coords)
    frame = utils.addtext(frame,
                          "Pickhand has found {} fingertips".format(
                              sum([1 for _ in pickhand])),
                          location="ur")
    frame = reduce(utils.addcircle, [frame] + list(pickhand))
    frame = utils.addrectangle(frame, frethand_coords)
    frame = utils.addtext(frame,
                          "Frethand has found {} fingertips".format(
                              sum([1 for _ in frethand])),
                          location="ul")
    frame = reduce(utils.addcircle, [frame] + list(frethand))
    return frame
Beispiel #2
0
def add_to_tablature(frame):
    # Get the guitar's POI in the frame
    guitar = guitarmodel.get_guitar(frame)
    if not guitar:
        raise ValueError("No guitar!")
    # Get the hand models for both hands
    (pickhand, frethand) = \
        handmodel.get_hands(frame, guitar)
    if not pickhand or not frethand:
        raise ValueError("No hand(s)!")
    
    global tablature 
    tablature.append(get_note(pickhand, frethand, guitar))
    return tablature
Beispiel #3
0
def main(frame):
    # Get the guitar model
    guitar = guitarmodel.get_guitar(frame)

    # Return unchanged frame if no guitar
    if not guitar:
        return frame
    
    # Get the hands (list of fingertips) in the frame
    (pickhand, frethand) = get_hands(frame, guitar)
    
    # Print for debugging and testing purposes
    sys.stderr.write( errorstring.format(list(pickhand), list(frethand)) ) 
    
    # Add overlay circles on fingers for display
    frame = utils.addrectangle(frame, pickhand_coords)
    frame = utils.addtext(frame, "Pickhand has found {} fingertips".format(sum([1 for _ in pickhand])), location="ur")
    frame = reduce(utils.addcircle, [frame] + list(pickhand))
    frame = utils.addrectangle(frame, frethand_coords)
    frame = utils.addtext(frame, "Frethand has found {} fingertips".format(sum([1 for _ in frethand])), location="ul")
    frame = reduce(utils.addcircle, [frame] + list(frethand))
    return frame