o
    Wh                     @   s4   d dl mZmZmZ d dlmZ G dd deZdS )    )BaseSolutionSolutionAnnotatorSolutionResults)colorsc                       s(   e Zd ZdZ fddZdd Z  ZS )	VisionEyea  
    A class to manage object detection and vision mapping in images or video streams.

    This class extends the BaseSolution class and provides functionality for detecting objects,
    mapping vision points, and annotating results with bounding boxes and labels.

    Attributes:
        vision_point (Tuple[int, int]): Coordinates (x, y) where vision will view objects and draw tracks.

    Methods:
        process: Process the input image to detect objects, annotate them, and apply vision mapping.

    Examples:
        >>> vision_eye = VisionEye()
        >>> frame = cv2.imread("frame.jpg")
        >>> results = vision_eye.process(frame)
        >>> print(f"Total detected instances: {results.total_tracks}")
    c                    s$   t  jdi | |dd| _dS )z
        Initialize the VisionEye class for detecting objects and applying vision mapping.

        Args:
            **kwargs (Any): Keyword arguments passed to the parent class and for configuring vision_point.
        vision_point)   r   N )super__init__getr   )selfkwargs	__class__r	   T/var/www/vscode/kcb/lib/python3.10/site-packages/ultralytics/solutions/vision_eye.pyr      s   zVisionEye.__init__c                 C   s   |  | t|| j}t| j| j| j| jD ]\}}}}|j|| 	|||t
t|dd ||| j q| }| | t|t| jdS )a  
        Perform object detection, vision mapping, and annotation on the input image.

        Args:
            im0 (numpy.ndarray): The input image for detection and annotation.

        Returns:
            (SolutionResults): Object containing the annotated image and tracking statistics.
                - plot_im: Annotated output image with bounding boxes and vision mapping
                - total_tracks: Number of tracked objects in the frame

        Examples:
            >>> vision_eye = VisionEye()
            >>> frame = cv2.imread("image.jpg")
            >>> results = vision_eye.process(frame)
            >>> print(f"Detected {results.total_tracks} objects")
        T)labelcolor)plot_imtotal_tracks)extract_tracksr   
line_widthzipclss	track_idsboxesconfs	box_labeladjust_box_labelr   int	visioneyer   resultdisplay_outputr   len)r   im0	annotatorclst_idboxconfr   r	   r	   r   process'   s   
"$
zVisionEye.process)__name__
__module____qualname____doc__r   r*   __classcell__r	   r	   r   r   r      s    r   N)ultralytics.solutions.solutionsr   r   r   ultralytics.utils.plottingr   r   r	   r	   r	   r   <module>   s   