gbvision.utils.finders package

Submodules

gbvision.utils.finders.circle_finder module

class gbvision.utils.finders.circle_finder.CircleFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: gbvision.utils.finders.object_finder.ShapeFinder

Finds specific circular shaped object, and performs distance transformation

gbvision.utils.finders.contour_finder module

class gbvision.utils.finders.contour_finder.ContourFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: gbvision.utils.finders.object_finder.ShapeFinder

Finds any generic shape, not recommended when another finder can be used

gbvision.utils.finders.convex_polygon_finder module

class gbvision.utils.finders.convex_polygon_finder.ConvexPolygonFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: gbvision.utils.finders.object_finder.ShapeFinder

Finds any generic convex polygon, not recommended when another finder can be used

gbvision.utils.finders.object_finder module

class gbvision.utils.finders.object_finder.ShapeFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: abc.ABC

This is an abstract class that represents an object finder An object finder is a type that outputs an object’s 3d real location based on an of it image it’s GameObject real-life parameters

Parameters:
  • threshold_func – The threshold function used to find the shapes in the frame
  • game_object – The game object descriptor for the real-life parameters of the finder’s target
  • contours_hook – Optional. A pipeline to run on the contours after finding them
  • shapes_hook – Optional. A pipeline to run on the shapes after parsing the contours to them
find_and_filter_shapes(frame: Optional[numpy.ndarray]) → List[Shape][source]

Finds all the shapes and returns them in frame after full pipeline (sorted), removes all inner shapes

Param:The current frame the finder searches in
Returns:A list of shapes: see gbvision/constants/types
find_shapes(frame: Optional[numpy.ndarray]) → List[Shape][source]

Finds all the shapes and returns them in frame after full pipeline (sorted)

Param:The current frame the finder searches in
Returns:A list of shapes: see gbvision/constants/types
find_shapes_unsorted(frame: Optional[numpy.ndarray]) → List[Shape][source]

Finds all the shapes and returns them in frame after full pipeline (not sorted)

Param:The current frame the finder searches in
Returns:A list of shapes: see gbvision/constants/types
locations_from_shapes(shapes: Iterable[Shape], camera: gbvision.utils.cameras.camera.Camera) → List[Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], numpy.ndarray]][source]

Finds the locations of the shapes based on the shape descriptor and camera constants

Parameters:
  • shapes – A list of the shapes
  • camera – The camera used to capture the frame that the shapes were found in
Returns:

A list of the locations of all the shapes

gbvision.utils.finders.polygon_finder module

class gbvision.utils.finders.polygon_finder.PolygonFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: gbvision.utils.finders.object_finder.ShapeFinder

Finds any generic polygon, not recommended when another finder can be used

gbvision.utils.finders.rect_finder module

class gbvision.utils.finders.rect_finder.RectFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: gbvision.utils.finders.object_finder.ShapeFinder

Finds a rectangular shaped object

gbvision.utils.finders.rotated_rect_finder module

class gbvision.utils.finders.rotated_rect_finder.RotatedRectFinder(threshold_func: Union[Callable[[Optional[numpy.ndarray]], Optional[numpy.ndarray]], gbvision.utils.thresholds.threshold.Threshold], game_object: gbvision.utils.game_object.GameObject = <gbvision.utils.game_object.GameObject object>, contours_hook: Callable[[List[numpy.ndarray]], List[numpy.ndarray]] = <gbvision.utils.pipeline.PipeLine object>, shapes_hook: Callable[[List[Shape]], List[Shape]] = <gbvision.utils.pipeline.PipeLine object>)[source]

Bases: gbvision.utils.finders.object_finder.ShapeFinder

Finds a rectangular object, but rotated. Recommended to use when you know the shape isn’t parallel to the camera

Module contents