OBB Docs updates (#7568)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Muhammad Rizwan Munawar <chr043416@gmail.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
9d4ffa43bc
commit
596c068b18
8 changed files with 52 additions and 43 deletions
|
|
@ -83,20 +83,19 @@
|
|||
"model = YOLO(\"yolov8n.pt\")\n",
|
||||
"cap = cv2.VideoCapture(\"path/to/video/file.mp4\")\n",
|
||||
"assert cap.isOpened(), \"Error reading video file\"\n",
|
||||
"\n",
|
||||
"w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))\n",
|
||||
"\n",
|
||||
"# Video writer\n",
|
||||
"video_writer = cv2.VideoWriter(\"/content/people walking gray.mp4\",\n",
|
||||
"video_writer = cv2.VideoWriter(\"heatmap_output.avi\",\n",
|
||||
" cv2.VideoWriter_fourcc(*'mp4v'),\n",
|
||||
" fps,\n",
|
||||
" (w, h))\n",
|
||||
" (w, h))\n",
|
||||
"\n",
|
||||
"# Init heatmap\n",
|
||||
"heatmap_obj = heatmap.Heatmap()\n",
|
||||
"heatmap_obj.set_args(colormap=cv2.COLORMAP_PARULA ,\n",
|
||||
" imw=cap.get(4), # should same as cap height\n",
|
||||
" imh=cap.get(3), # should same as cap width\n",
|
||||
"heatmap_obj.set_args(colormap=cv2.COLORMAP_PARULA,\n",
|
||||
" imw=w,\n",
|
||||
" imh=h,\n",
|
||||
" view_img=True,\n",
|
||||
" shape=\"circle\")\n",
|
||||
"\n",
|
||||
|
|
@ -143,4 +142,4 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -83,11 +83,10 @@
|
|||
"model = YOLO(\"yolov8n.pt\")\n",
|
||||
"cap = cv2.VideoCapture(\"path/to/video/file.mp4\")\n",
|
||||
"assert cap.isOpened(), \"Error reading video file\"\n",
|
||||
"\n",
|
||||
"w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))\n",
|
||||
"\n",
|
||||
"# Define line points\n",
|
||||
"line_points = [(20, 400), (1080, 400)]\n",
|
||||
"# Define region points\n",
|
||||
"region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360)]\n",
|
||||
"\n",
|
||||
"# Video writer\n",
|
||||
"video_writer = cv2.VideoWriter(\"object_counting_output.avi\",\n",
|
||||
|
|
@ -98,7 +97,7 @@
|
|||
"# Init Object Counter\n",
|
||||
"counter = object_counter.ObjectCounter()\n",
|
||||
"counter.set_args(view_img=True,\n",
|
||||
" reg_pts=line_points,\n",
|
||||
" reg_pts=region_points,\n",
|
||||
" classes_names=model.names,\n",
|
||||
" draw_tracks=True)\n",
|
||||
"\n",
|
||||
|
|
@ -145,4 +144,4 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue