Reformat Markdown code blocks (#12795)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
2af71d15a6
commit
fceea033ad
128 changed files with 1067 additions and 1018 deletions
|
|
@ -39,8 +39,8 @@ Speed estimation is the process of calculating the rate of movement of an object
|
|||
=== "Speed Estimation"
|
||||
|
||||
```python
|
||||
from ultralytics import YOLO, solutions
|
||||
import cv2
|
||||
from ultralytics import YOLO, solutions
|
||||
|
||||
model = YOLO("yolov8n.pt")
|
||||
names = model.model.names
|
||||
|
|
@ -50,17 +50,18 @@ Speed estimation is the process of calculating the rate of movement of an object
|
|||
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
|
||||
video_writer = cv2.VideoWriter("speed_estimation.avi", cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
|
||||
video_writer = cv2.VideoWriter("speed_estimation.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
|
||||
|
||||
line_pts = [(0, 360), (1280, 360)]
|
||||
|
||||
# Init speed-estimation obj
|
||||
speed_obj = solutions.SpeedEstimator(reg_pts=line_pts,
|
||||
names=names,
|
||||
view_img=True)
|
||||
speed_obj = solutions.SpeedEstimator(
|
||||
reg_pts=line_pts,
|
||||
names=names,
|
||||
view_img=True,
|
||||
)
|
||||
|
||||
while cap.isOpened():
|
||||
|
||||
success, im0 = cap.read()
|
||||
if not success:
|
||||
print("Video frame is empty or video processing has been successfully completed.")
|
||||
|
|
@ -74,7 +75,6 @@ Speed estimation is the process of calculating the rate of movement of an object
|
|||
cap.release()
|
||||
video_writer.release()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
```
|
||||
|
||||
???+ warning "Speed is Estimate"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue