How to count number of passengers in a vehicle?

Hi, I’m currently planning planning to take a video of a highway from an overhead bridge and be able to count the number of passenger in each vehicle through a bounding box and here is where I’m stuck at.

Sample Image from overhead bridge of a highway

Some problems faced:

  1. There is an issue in counting the number of passengers at the back seat
  2. Video quality may not be the best due to lighting or fps

I’m currently unsure of how to tackle both questions with the simplest solution coming up to my mind is to be standing on the side of a traffic junction and taking a video.

For model wise, I was initially thinking of just using OpenCV to count the number of passengers but as mentioned regarding the picture/video quality would greatly affect the outcome, but nevertheless would like to explore any alternatives that the community have!

Appreciate any help, thank you and have a great day.

1 Like

In my opinion, there are three important things to counting the number of passengers.
First of all, camera must capture the patterns of person at the back seat, just like face, texture of clothes and so on , which is the key factor to detect.
Secondly, you must trim the passengers figure and make sure this trimmed figures which used to train the ML model include the patterns mentioned by former section.
Thirdly, choose the ML methods like SVM, Adaboost which are traditional and YOLO, dlib which are deep learning methods to train model and use the trained model to detect the patterns then count the number of passenger.
The critical problem are image capture and sample full of patterns. It’s no need to be anxiety about the picture/ video quality although the samples may be ruined by sunlight etc.


I think that first detect the front window frame and crop it from the image. Then use these cropped images in Haar Cascade for Detection of Person. You can also use different techniques to enhance the detection of People and also the Front Window Frame like Canny Edge Detection, Gaussian Blur, and others. Counting people can be done by using Built-in functions like predict(), detectmultiscale() and others. Thanks