Example #1
0
def length(frames, amount_used=.1):
    """
       Feature based on the average distance each finger moves in the gesture
    """

    num_frames = len(frames)
    num_used = int(amount_used * num_frames)

    firsts = [[] for i in range(num_used)]
    lasts = [[] for i in range(num_used)]

    for f, first in zip(frames[0:num_used], firsts):
        positions = get_positions(f)
        for position in positions:
            first.append(position)
    for f, last in zip(frames[-num_used:], lasts):
        positions = get_positions(f)
        for position in positions:
            last.append(position)

    lengths = [
        utils.norm(
            utils.subtract(utils.average_position(first),
                           utils.average_position(last)))
        for first, last in zip(firsts, lasts)
    ]

    return lengths
Example #2
0
def average_velocity(frames):
    values = []
    for frame in frames:
        for hand in frame.hands():
            for finger in hand.fingers():
                values.append(finger.velocity())
    average_value = utils.average_position(values)
    return [average_value.x,average_value.y,average_value.z]
Example #3
0
def average_velocity(frames):
    values = []
    for frame in frames:
        for hand in frame.hands():
            for finger in hand.fingers():
                values.append(finger.velocity())
    average_value = utils.average_position(values)
    return [average_value.x, average_value.y, average_value.z]
Example #4
0
def average_velocity(frames):
    """
        Feature based on the average velocity of all of the finger tips in the gesture
    """
    values = []
    for frame in frames:
        for hand in frame.hands():
            for finger in hand.fingers():
                values.append(finger.velocity())
    average_value = utils.average_position(values)
    return [average_value.x, average_value.y, average_value.z]
Example #5
0
def average_velocity(frames):
    """
        Feature based on the average velocity of all of the finger tips in the gesture
    """
    values = []
    for frame in frames:
        for hand in frame.hands():
            for finger in hand.fingers():
                values.append(finger.velocity())
    average_value = utils.average_position(values)
    return [average_value.x,average_value.y,average_value.z]
Example #6
0
def length(frames,amount_used=.1):
    """
        Returns the average distance each finger moves in the gesture
    """

    num_frames = len(frames)
    num_used = int(amount_used*num_frames)

    firsts = [[] for i in range(num_used)]
    lasts = [[] for i in range(num_used)]

    for f,first in zip(frames[0:num_used],firsts):
        positions = get_positions(f)
        for position in positions:
            first.append(position)
    for f,last in zip(frames[-num_used:],lasts):
        positions = get_positions(f)
        for position in positions:
            last.append(position)

    lengths = [utils.norm(utils.subtract(utils.average_position(first),utils.average_position(last))) for first,last in zip(firsts,lasts)]

    return lengths