From the course: Hands-On AI: Computer Vision Projects with Ultralytics and OpenCV

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

How to count the objects

How to count the objects

- [Instructor] Let's suppose you want to count the vehicles that are entering the specific zone. With the help of ultralytics solutions, you can count these. In this video, we will explore how to use the ObjectCounting solution with Ultralytics Python package. The resources used in this video are available in the course code sub-directory 04-02. Let's quickly review the code structure. This is the same structure that we will use in all the videos of this chapter. In line number one and two, we imported the open CV library and solutions module from ultralytics. In line number four, we are using the video capture to read the video file. Line number five, we are extracting the weight, height, and FPS of the video file. In line number 10, we are initializing the video writer that it will use to write the output of the solutions. Let's go to line number 18. Here, we need to initialize the object-counting module. We will do it later. Let's continue to next line, which is 22. Here we are…

Contents