概述
Ultralytics提供了一系列的解决方案,利用YOLO11解决现实世界的问题,包括物体计数、模糊处理、热力图、安防系统、速度估计、物体追踪等多个方面的应用。
VisionEye 可让计算机模拟人眼的观察角度,识别并精确定位物体。这一功能使计算机能够辨别并聚焦于特定物体,就像人眼从特定视角观察细节一样。
演示代码
Ultralytics提供了演示代码,展示如何使用VsionEye解决方案。
import cv2
from ultralytics import solutions
cap = cv2.VideoCapture("path/to/video.mp4")
assert cap.isOpened(), "Error reading video file"
# Video writer
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
video_writer = cv2.VideoWriter("visioneye_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize vision eye object
visioneye = solutions.VisionEye(
show=True, # display the output
model="yolo11n.pt", # use any model that Ultralytics support, i.e, YOLOv10
classes=[0, 2], # generate visioneye view for specific classes
vision_point=(50, 50), # the point, where vision will view objects and draw tracks
)
# Process video
while cap.isOpened():
success, im0 = cap.read()
if not success:
print("Video frame is empty or video processing has been successfully completed.")
break
results = visioneye(im0)
print(results) # access the output
video_writer.write(results.plot_im) # write the video file
cap.release()
video_writer.release()
cv2.destroyAllWindows() # destroy all opened windows
VisionEye
参数
基本参数
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
model |