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 display(frame, guitar): if guitar["available"]: text = "" for attr, lines in guitar["locations"].items(): text += "Number of " + attr + ": {}\n".format(len(lines)) frame = reduce(utils.addline, [frame] + lines) frame = utils.addtext(frame, text, "ul") 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
def main(frame): # Flip the frame for ease of understanding frame = utils.mirror(frame) # Add tablature to frame in LR corner frame = utils.addtext(frame, get_tab(frame), 'lr') return frame