Reference for ultralytics/solutions/vision_eye.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/solutions/vision_eye.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.solutions.vision_eye.VisionEye
Bases: BaseSolution
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:
Name | Type | Description |
---|---|---|
vision_point |
Tuple[int, int]
|
Coordinates (x, y) where vision will view objects and draw tracks. |
Methods:
Name | Description |
---|---|
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}")
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
Any
|
Keyword arguments passed to the parent class and for configuring vision_point. |
{}
|
Source code in ultralytics/solutions/vision_eye.py
process
Perform object detection, vision mapping, and annotation on the input image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im0
|
ndarray
|
The input image for detection and annotation. |
required |
Returns:
Type | Description |
---|---|
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")