Open links in new tab
  1. Object detection and counting involve identifying objects in an image or video and determining their total number. This can be achieved using deep learning models like YOLO (You Only Look Once) for detection and OpenCV for image processing and counting.

    Using YOLO with OpenCV YOLO models (e.g., YOLOv3, YOLO11) can detect multiple object classes in real-time. Once objects are detected, OpenCV can be used to draw bounding boxes and count detections.

    Example with Ultralytics YOLO11 for counting in a defined region:

    import cv2
    from ultralytics import solutions

    def count_objects(video_path, output_path, model_path):
    cap = cv2.VideoCapture(video_path)
    assert cap.isOpened(), "Error reading video file"

    w, h, fps = (int(cap.get(x)) for x in (
    cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
    writer = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

    region_points = [(20, 400), (1080, 400), (1080, 360), (20, 360)]
    counter = solutions.ObjectCounter(show=True, region=region_points, model=model_path)

    while cap.isOpened():
    success, frame = cap.read()
    if not success:
    break
    results = counter(frame)
    writer.write(results.plot_im)

    cap.release()
    writer.release()
    cv2.destroyAllWindows()

    count_objects("input.mp4", "output.avi", "yolo11n.pt")
    Copied!
    Feedback
  2. YOLOv8 Object Tracking and Counting - LearnOpenCV

      1. YOLOv8 architecture. Ultralytics has released a complete repository for YOLO Models. Also, …
      2. Journey of Object Detection. A paper by Zhengxia Zou, Keyan Chen, et al. [1] suggests that the …
      3. Object Tracking using OpenCV. OpenCV primarily provides eight different trackers available in …
      4. Object Tracking. You might have a question at this point: Can you easily detect the object in every …
      5. Recent MOT Approaches. Author Mk Bashar, Samia Islam, et al. [4] Their paper explained the …
  3. Track and Count Objects Using YOLOv8 - Roboflow Blog

    Feb 1, 2023 · YOLOv8 provides an SDK that allows training or prediction in just a few lines of Python code. We recently published an article that describes the new …

  4. Object Counting using Ultralytics YOLO26

    4 days ago · YOLO26 excels in real-time applications, providing efficient and precise object counting for various scenarios like crowd analysis and surveillance, thanks to its state-of-the-art algorithms and …

  5. Count number of Object using Python-OpenCV

    Jul 23, 2025 · OpenCv: OpenCv is an open-source library that is useful for computer vision applications such as image processing, video processing, facial …

  6. People also ask
  7. Object Detection from Images and Counting Objects in ...

    Feb 5, 2021 · Learn how to detect objects from images and count them using Python! In this tutorial, we will show you how to use OpenCV and CVLib to …

  8. how-to-count-the-objects-using-ultralytics-yolo.ipynb

    YOLO11 excels in real-time applications, providing efficient and precise object counting for various scenarios like crowd analysis and surveillance, thanks to its …

  9. Step-by-Step Guide to Implementing YOLO Object …

    May 23, 2024 · In this post, we'll walk through the steps to implement YOLO object detection and counting, using vehicle tracking as our practical example

  10. Object Detection and Counting System - GitHub

    A comprehensive Python-based object detection system that automatically detects and counts objects in video feeds using YOLO (You Only Look Once) deep learning model.

  11. object_counting.ipynb - Colab

    For more information on counting objects with Ultralytics, you can explore the comprehensive Ultralytics Object Counting Docs. This guide covers everything …

  12. Deep dive into Object Detection and Counting Python

By using this site you agree to the use of cookies for analytics, personalized content, and ads.Learn more about third party cookies|Microsoft Privacy Policy