gbvision.utils package¶
Subpackages¶
- gbvision.utils.cameras package
- Submodules
- gbvision.utils.cameras.async_camera module
- gbvision.utils.cameras.async_usb_camera module
- gbvision.utils.cameras.camera module
- gbvision.utils.cameras.camera_data module
- gbvision.utils.cameras.camera_list module
- gbvision.utils.cameras.empty_camera module
- gbvision.utils.cameras.stream_camera module
- gbvision.utils.cameras.streaming_camera module
- gbvision.utils.cameras.usb_camera module
- gbvision.utils.cameras.usb_streaming_camera module
- Module contents
- gbvision.utils.continuity package
- gbvision.utils.denoising package
- gbvision.utils.drawing package
- Submodules
- gbvision.utils.drawing.draw_circles module
- gbvision.utils.drawing.draw_contours module
- gbvision.utils.drawing.draw_ellipses module
- gbvision.utils.drawing.draw_lines module
- gbvision.utils.drawing.draw_points module
- gbvision.utils.drawing.draw_rects module
- gbvision.utils.drawing.draw_rotated_rects module
- gbvision.utils.drawing.draw_shapes module
- Module contents
- gbvision.utils.finders package
- Submodules
- gbvision.utils.finders.circle_finder module
- gbvision.utils.finders.contour_finder module
- gbvision.utils.finders.convex_polygon_finder module
- gbvision.utils.finders.object_finder module
- gbvision.utils.finders.polygon_finder module
- gbvision.utils.finders.rect_finder module
- gbvision.utils.finders.rotated_rect_finder module
- Module contents
- gbvision.utils.net package
- Submodules
- gbvision.utils.net.async_fragmented_udp_stream_receiver module
- gbvision.utils.net.async_stream_receiver module
- gbvision.utils.net.async_tcp_stream_receiver module
- gbvision.utils.net.async_udp_stream_receiver module
- gbvision.utils.net.fragmented_udp_stream_broadcaster module
- gbvision.utils.net.fragmented_udp_stream_receiver module
- gbvision.utils.net.stream_broadcaster module
- gbvision.utils.net.stream_receiver module
- gbvision.utils.net.tcp_stream_broadcaster module
- gbvision.utils.net.tcp_stream_receiver module
- gbvision.utils.net.udp_stream_broadcaster module
- gbvision.utils.net.udp_stream_receiver module
- Module contents
- gbvision.utils.recorders package
- gbvision.utils.shapes package
- Submodules
- gbvision.utils.shapes.base_circle module
- gbvision.utils.shapes.base_contour module
- gbvision.utils.shapes.base_convex_polygon module
- gbvision.utils.shapes.base_ellipse module
- gbvision.utils.shapes.base_line module
- gbvision.utils.shapes.base_point module
- gbvision.utils.shapes.base_polygon module
- gbvision.utils.shapes.base_rect module
- gbvision.utils.shapes.base_rotated_rect module
- gbvision.utils.shapes.base_shape module
- Module contents
- gbvision.utils.thresholds package
Submodules¶
gbvision.utils.async_readable module¶
-
class
gbvision.utils.async_readable.AsyncReadable[source]¶ Bases:
gbvision.utils.readable.Readable,abc.ABCAn async readable class that constantly reads on another thread
-
has_started_reading() → bool[source]¶ Checks if the async thread has started reading
Returns: True if the async thread started, False otherwise
-
gbvision.utils.game_object module¶
-
class
gbvision.utils.game_object.GameObject(root_area: Union[int, float])[source]¶ Bases:
objectconstructor of the image object which is an object on field
Parameters: root_area – the square root of the surface area of the object in real life -
distance(camera: gbvision.utils.cameras.camera.Camera, root_area: Union[int, float]) → float[source]¶ Note: this measures the distance between the camera and the object, to use another measuring point calculate the norm of the location
Parameters: - camera – the camera, can be either Camera or CameraList
- root_area – a float representing the square root of the area of the object (in pixels)
Returns: the norm of the vector between the camera and the object (in meters)
-
location(camera: gbvision.utils.cameras.camera.Camera, root_area: Union[int, float], center: Tuple[Union[int, float], Union[int, float]]) → Union[Tuple[Union[int, float], Union[int, float], Union[int, float]], numpy.ndarray][source]¶ Calculates the 3D location of this object, relative to the camera
Parameters: - camera – the camera, can be either Camera or CameraList
- root_area – a float representing the square root of the area of the object (in pixels)
- center – the center (x,y) of this object in the frame
Returns: a 3d vector of the relative [x y z] location between the object and the camera/measuring point (in meters)
-
gbvision.utils.pipeline module¶
-
class
gbvision.utils.pipeline.PipeLine(*functions, qualname: Optional[str] = None, module: Optional[str] = None)[source]¶ Bases:
objectA class representing a pipeline of function each function receives one input, which is the output of the previous function in the pipeline pipelines are great for representing a long computer vision function (which is why such functions are called pipelines). the PipeLine class can also be used as a function decorator for example, creating a pipeline that adds 1 to it’s output can be done in two ways: Example:
inc = PipeLine(lambda x: x + 1) three = inc(2)
or Example:
@PipeLine def inc(x): return x + 1 three = inc(2)
You can create a PipeLine from multiple functions: Example:
open_and_read_file = PipeLine(open, lambda x: x.read()) text = open_and_read_file("file.txt")
You can also inherit from the PipeLine class to make a PipeLine factory: Example:
class Adder(PipeLine): def __init__(self, num): self.num = num PipeLine.__init__(self, self.adding_func) def adding_func(self, item): return item + self.num
You can also do it like this: Example:
class Adder(PipeLine): def __init__(self, num): def adding_func(item): return item + num PipeLine.__init__(self, adding_func)
You can use combine a few PipeLines together to create function composition: Example:
multiply_by_2_then_add_3 = PipeLine(lambda x: x * 2) + PipeLine(lambda x: x + 3)
Parameters: - functions – A tuple of functions to run one after the other as a pipeline
- qualname – Optional. A string that will be the __qualname__ of the pipeline object
- module – Optional. A string that will be the __module__ of the pipeline object
gbvision.utils.readable module¶
-
class
gbvision.utils.readable.Readable[source]¶ Bases:
gbvision.utils.releasable.Releasable,abc.ABCAn interface representing an object you can read frames from, such as cameras and streams
gbvision.utils.releasable module¶
gbvision.utils.tracker module¶
-
class
gbvision.utils.tracker.Tracker(tracker_type: str = 'EMPTY')[source]¶ Bases:
objectA tracker object that tracks a rectangle in a video using an opencv tracking algorithm
Parameters: tracker_type – Tracker algorithm taken from this list: BOOSTING, MIL, KCF, TLD, MEDIANFLOW, GOTURN, MOSSE, CSRT, EMPTY. (Default is EMPTY) -
TRACKER_TYPE_BOOSTING= 'BOOSTING'¶
-
TRACKER_TYPE_CSRT= 'CSRT'¶
-
TRACKER_TYPE_EMPTY= 'EMPTY'¶
-
TRACKER_TYPE_GOTURN= 'GOTURN'¶
-
TRACKER_TYPE_KCF= 'KCF'¶
-
TRACKER_TYPE_MEDIANFLOW= 'MEDIANFLOW'¶
-
TRACKER_TYPE_MIL= 'MIL'¶
-
TRACKER_TYPE_MOSSE= 'MOSSE'¶
-
TRACKER_TYPE_TLD= 'TLD'¶
-