ultralytics 8.0.237 cv2.CAP_PROP fix and in_counts and out_counts displays (#7380)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: ayush chaurasia <ayush.chaurarsia@gmail.com>
Co-authored-by: Muhammad Rizwan Munawar <chr043416@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: 曾逸夫(Zeng Yifu) <41098760+Zengyf-CVer@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2024-01-07 19:06:57 +01:00 committed by GitHub
parent 71fe5e919d
commit 8c2b2f56b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 108 additions and 90 deletions

View file

@ -84,11 +84,13 @@
"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(\"heatmap_output.avi\",\n",
"video_writer = cv2.VideoWriter(\"/content/people walking gray.mp4\",\n",
" cv2.VideoWriter_fourcc(*'mp4v'),\n",
" int(cap.get(5)),\n",
" (int(cap.get(3)), int(cap.get(4))))\n",
" fps,\n",
" (w, h))\n",
"\n",
"# Init heatmap\n",
"heatmap_obj = heatmap.Heatmap()\n",

View file

@ -84,14 +84,16 @@
"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",
"\n",
"# Video writer\n",
"video_writer = cv2.VideoWriter(\"object_counting_output.avi\",\n",
" cv2.VideoWriter_fourcc(*'mp4v'),\n",
" int(cap.get(5)),\n",
" (int(cap.get(3)), int(cap.get(4))))\n",
" fps,\n",
" (w, h))\n",
"\n",
"# Init Object Counter\n",
"counter = object_counter.ObjectCounter()\n",

View file

@ -85,7 +85,7 @@
{
"cell_type": "code",
"source": [
"!yolo track source=\"/content/people walking gray.mp4\" save=True"
"!yolo track source=\"/path/to/video/file.mp4\" save=True"
],
"metadata": {
"id": "-XJqhOwo6iqT"
@ -124,13 +124,12 @@
"cap = cv2.VideoCapture(video_path)\n",
"assert cap.isOpened(), \"Error reading video file\"\n",
"\n",
"frame_width = int(cap.get(3))\n",
"frame_height = int(cap.get(4))\n",
"size = (frame_width, frame_height)\n",
"result = cv2.VideoWriter('object_tracking.avi',\n",
" cv2.VideoWriter_fourcc(*'MJPG'),\n",
" int(cap.get(5)), size)\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",
"result = cv2.VideoWriter(\"object_tracking.avi\",\n",
" cv2.VideoWriter_fourcc(*'mp4v'),\n",
" fps,\n",
" (w, h))\n",
"\n",
"while cap.isOpened():\n",
" success, frame = cap.read()\n",
@ -175,7 +174,7 @@
"metadata": {
"id": "Cx-u59HQdu2o"
},
"execution_count": 3,
"execution_count": null,
"outputs": []
},
{