Exemple #1
0
 def __call__(self, frame, camera):
     contours = self._full_pipeline(frame)
     return list(
         map(
             lambda cnt: self.game_object.location_by_params(
                 camera, self.area_scalar * np.sqrt(cv2.contourArea(cnt)),
                 contour_center(cnt)), contours))
 def location_by_contours(self, camera: Camera, cnt):
     """
     :param camera: the camera, can be either Camera or CameraList
     :param cnt: the contours of this object in the frame
     :return: a 3d vector of the relative [x y z] location between the object and the camera (in meters)
     """
     return self.location_by_params(camera, np.sqrt(cv2.contourArea(cnt)),
                                    contour_center(cnt))
Exemple #3
0
 def shape_center(shape: Polygon) -> Point:
     return contour_center(shape)
Exemple #4
0
 def shape_center(shape: Contour) -> Point:
     return contour_center(shape)