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
def main(frame): # Get guitar and hand bounding boxes guitar_coords = guitar(frame) # Print for debugging and testing purposes sys.stderr.write( errorstring.format(guitar_coords) ) # Add rectangles for debugging purposes around them frame = utils.addrectangle(frame, guitar_coords) return frame
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