in lambda/states/nose.py [0:0]
def __init__(self, challenge, original_frame):
self.challenge = challenge
self.image_width = challenge['imageWidth']
self.image_height = challenge['imageHeight']
# Applying tolerance
area_width_tolerance = challenge['areaWidth'] * NoseState.AREA_BOX_TOLERANCE
area_height_tolerance = challenge['areaHeight'] * NoseState.AREA_BOX_TOLERANCE
self.area_box = (challenge['areaLeft'] - area_width_tolerance,
challenge['areaTop'] - area_height_tolerance,
challenge['areaWidth'] + 2*area_width_tolerance,
challenge['areaHeight'] + 2*area_height_tolerance)
nose_width_tolerance = challenge['noseWidth'] * NoseState.NOSE_BOX_TOLERANCE
nose_height_tolerance = challenge['noseHeight'] * NoseState.NOSE_BOX_TOLERANCE
self.nose_box = (challenge['noseLeft'] - nose_width_tolerance,
challenge['noseTop'] - nose_height_tolerance,
challenge['noseWidth'] + 2*nose_width_tolerance,
challenge['noseHeight'] + 2*nose_height_tolerance)
self.challenge_in_the_right = challenge['noseLeft'] + Challenge.NOSE_BOX_SIZE/2 > self.image_width/2
self.original_frame = original_frame
self.original_landmarks = original_frame['rekMetadata'][0]['Landmarks']
self.nose_trajectory = []