Exemplo n.º 1
0
 def get_original_bbox(self, i):
     #Note: no standard is suggested, let alone prescribed, for
     #the return values of bounds. We have chosen to return the
     #[x0, y0, x1, y1] list of coordinates.
     if within_bounds(i, len(self.bbox)):
         return self.bbox[i]
     return None
Exemplo n.º 2
0
 def get_eyes_location(self, i):
     if within_bounds(i, len(self.keyPointsDict)):
         points = self.keyPointsDict[i]
         try:
             try:
                 # the interface calls 'left' the right of the subject and vice versa for this function.
                 left = [
                     x0 + (x1 - x0) / 2
                     for x0, x1 in zip(points["left_eye_outer_corner"], points["left_eye_inner_corner"])
                 ]
             except KeyError:
                 left = [None, None]
         finally:
             try:
                 try:
                     right = [
                         x0 + (x1 - x0) / 2
                         for x0, x1 in zip(points["right_eye_inner_corner"], points["right_eye_outer_corner"])
                     ]
                 except KeyError:
                     right = [None, None]
             finally:
                 right.extend(left)
                 return right
     else:
         return [None, None, None, None]
Exemplo n.º 3
0
    def get_eyes_location(self, i):
        if within_bounds(i, len(self.keyPointsDict)):
            points = self.keyPointsDict[i]

            right = None
            left = None

            try:
                try:
                    right = [
                        points['right_eye_pupil'][0],
                        points['right_eye_pupil'][1]
                    ]
                    left = [
                        points['left_eye_pupil'][0],
                        points['left_eye_pupil'][1]
                    ]
                except KeyError:
                    if right is not None:
                        left = [None, None]
                    else:
                        right = [None, None]
                        try:
                            left = [
                                points['left_eye_pupil'][0],
                                points['left_eye_pupil'][1]
                            ]
                        except KeyError:
                            left = [None, None]
            finally:
                right.extend(left)
                return right
        return [None, None, None, None]
Exemplo n.º 4
0
 def get_eyes_location(self, i):
     if within_bounds(i, len(self.keyPointsDict)):
         points = self.keyPointsDict[i]
         try:
             try:
                 #the interface calls 'left' the right of the subject and vice versa for this function.
                 left = [
                     x0 + (x1 - x0) / 2
                     for x0, x1 in zip(points['left_eye_outer_corner'],
                                       points['left_eye_inner_corner'])
                 ]
             except KeyError:
                 left = [None, None]
         finally:
             try:
                 try:
                     right = [
                         x0 + (x1 - x0) / 2
                         for x0, x1 in zip(points['right_eye_inner_corner'],
                                           points['right_eye_outer_corner'])
                     ]
                 except KeyError:
                     right = [None, None]
             finally:
                 right.extend(left)
                 return right
     else:
         return [None, None, None, None]
Exemplo n.º 5
0
    def get_eyes_location(self, i):
        if within_bounds(i, len(self.keyPointsDict)):
            points = self.keyPointsDict[i]
            
            try:
                left = [x0 + (x1 - x0)/2 for x0, x1 in zip(points['right_eye_center_top'], points['right_eye_center_bottom'])]
                right = [x0 + (x1 - x0)/2 for x0, x1 in zip(points['left_eye_center_top'], points['left_eye_center_bottom'])]
                left.extend(right)
                return tuple(left)

            except KeyError:
                return None
        else:
            return None
Exemplo n.º 6
0
    def get_eyes_location(self, i):
        if within_bounds(i, len(self.keyPointsDict)):
            points = self.keyPointsDict[i]
            
            try:
                left = [x0 + (x1 - x0)/2 for x0, x1 in zip(points['right_eye_center_top'], points['right_eye_center_bottom'])]
                right = [x0 + (x1 - x0)/2 for x0, x1 in zip(points['left_eye_center_top'], points['left_eye_center_bottom'])]
                left.extend(right)
                return tuple(left)

            except KeyError:
                return None
        else:
            return None
Exemplo n.º 7
0
    def get_eyes_location(self, i):
        if within_bounds(i, len(self.keyPointsDict)):
            points = self.keyPointsDict[i]

            right = None
            left = None
            
            try:
                try:
                    right = [points['right_eye_pupil'][0], points['right_eye_pupil'][1]]
                    left = [points['left_eye_pupil'][0], points['left_eye_pupil'][1]]
                except KeyError:
                    if right is not None:
                        left = [None, None]
                    else:
                        right = [None, None]
                        try:
                            left = [points['left_eye_pupil'][0], points['left_eye_pupil'][1]]
                        except KeyError:
                            left = [None, None]
            finally:
                right.extend(left)
                return right
        return [None, None, None, None]
Exemplo n.º 8
0
 def get_eyes_location(self, i):
     if within_bounds(i, len(self.keyPointsDict)):
         points = self.keyPointsDict[i]
         
         try:
             try:
                 left = list(points['right_eye_center'])
                 if math.isnan(left[0]) or math.isnan(left[1]):
                     raise KeyError()
             except KeyError:
                 left = [None, None]
         finally:
             try:
                 try:
                     right = list(points['left_eye_center'])
                     if math.isnan(right[0]) or math.isnan(right[1]):
                         raise KeyError()
                 except KeyError:
                     right = [None, None]
             finally:
                 left.extend(right)
                 return left
     else:    
         return None
Exemplo n.º 9
0
 def get_keypoints_location(self, i):
     if within_bounds(i, len(self.keyPointsDict)):
         return [self.keyPointsDict[i]]
     return None
Exemplo n.º 10
0
 def get_original_image_path_relative_to_base_directory(self, i):
     if within_bounds(i, len(self.lstImages)):
         return self.lstImages[i]
     return None
Exemplo n.º 11
0
 def get_pan_tilt_and_roll(self, i):
     if within_bounds(i, len(self.yawPitchRoll)):
         return self.yawPitchRoll[i]
Exemplo n.º 12
0
 def get_keypoints_location(self, i):
     if within_bounds(i, len(self.keyPointsDict)):
         return [self.keyPointsDict[i]]
Exemplo n.º 13
0
 def get_original_image_path_relative_to_base_directory(self, i):
     if within_bounds(i, len(self.lstImages)):
         return self.lstImages[i]
     return None