Book a free call

Computer Vision in Vehicle Detection: How It Works on the Road

Computer vision spots, counts and reads vehicles for traffic, tolling and parking. Here is how vehicle detection works, where it is used, and what a system needs.

Hertiv engineering teamReviewed by a senior engineer
6 min read
Computer Vision in Vehicle Detection: How It Works on the Road
On this page

Short answer

Computer vision in vehicle detection uses cameras and trained detectors to find, count and identify vehicles on roads, in car parks and around depots. A detector draws a box around each vehicle, tracking links the boxes across frames, and the system turns them into counts, speeds, plate reads or alerts.

What is computer vision in vehicle detection?

Computer vision in vehicle detection is the use of cameras and image analysis to find, count and identify vehicles on roads, in car parks and around depots. A camera watches a scene, a model draws a box around each vehicle, and the system turns those boxes into counts, speeds, plate numbers or alerts.

The same core method serves very different jobs. Traffic teams count vehicles and measure queues. Toll operators read plates and charge the right account. Car parks count free spaces. Fleets check which vehicles are in the yard. The camera and the model are similar; the output and the rules change.

Use What the system returns Who uses it
Traffic counting Vehicles per lane and queue lengths Traffic control teams
Tolling Plate reads matched to accounts Toll operators
Parking Free and occupied bays Car park operators
Enforcement Speeds and lane violations Road authorities
Fleet yards Entry, exit and bay checks Fleet managers

Vehicle detection is a good first computer vision project because the object is large, the camera is fixed and the answer is easy to check. A person can count the vehicles in a frame and see whether the system agrees. See what object detection is for the underlying method.

How does vehicle detection work?

Vehicle detection works by running a trained detector on each frame from a camera. The detector is a neural network that has learned what cars, lorries, buses and motorcycles look like from thousands of labelled images. For each frame it returns a box, a type and a confidence score for every vehicle it finds.

Tracking links the boxes across frames, so the same car gets one identity as it moves through the scene. Without tracking, a car that appears in 30 frames would be counted 30 times. Tracking also gives speed and direction, by measuring how far the box moves between frames and how long the camera took to capture them.

Plate reading is a separate step. Once a vehicle is found, the system crops the plate area and runs optical character recognition to read the letters and numbers. Plate reading needs a clear, well-lit image of the plate, so the camera angle and the shutter speed matter more here than in simple counting.

Where is vehicle detection used on roads?

On roads, vehicle detection counts traffic, measures queues and spots incidents. A camera above a junction counts vehicles per lane, and the signal controller uses the counts to give more green time to the busier approach. The same cameras can spot a stopped vehicle or a wrong-way driver and raise an alert.

Tolling is the most direct use. A gantry camera reads each plate as the vehicle passes, matches it to an account and charges the toll without stopping traffic. The system must read plates at speed, in rain and at night, so the cameras use infrared light and fast shutters.

Enforcement uses detection too. Average speed cameras track a vehicle between two points and divide the distance by the time taken. Bus lane cameras check whether a vehicle in a bus lane is a bus. In each case the detection is only the first step; the decision follows a rule a person wrote, such as a speed limit or a lane restriction.

How is vehicle detection used in parking and fleets?

In car parks, vehicle detection counts free spaces and guides drivers to them. A camera over each bay, or one camera watching several bays, reports which spaces are occupied. The count feeds signs at the entrance and an app that shows drivers where to go, which cuts the time spent circling.

Fleets use detection in yards and depots. A camera at the gate logs every vehicle that enters and leaves, with the time and the plate, so the yard manager knows what is on site without a manual log. The same cameras can check that a vehicle is parked in the right bay before a shift starts.

The shared pattern is a fixed camera, a known scene and a simple question: how many, which ones, and where. When the question is that clear, a vehicle detection system can be built, tested and trusted quickly, because a person can check the answer by looking at the same image.

How do teams build a vehicle detection system?

Teams build a vehicle detection system by starting with the camera and the question, not with the model. The camera position, the light and the frame rate decide what the model can see, and no model fixes a badly placed camera.

  1. Define the question: count, identify or track, and what accuracy is good enough.
  2. Place the camera so vehicles are large in the frame and plates are readable where needed.
  3. Collect a week of footage covering day, night, rain and busy periods.
  4. Label a sample by hand and test a ready-made detector before training anything.
  5. Deploy with a person checking the counts for the first month, and fix the camera before retraining the model.

A common error is to buy the model first and fit the camera around it. The camera is the sensor, and a model trained on clear daylight images will fail on a dark, rainy feed. Spend the first budget on the camera, the mount and the light.

Example (hypothetical): a car park counts free spaces

Example (hypothetical): a shopping centre car park has 400 spaces across two floors and wants a sign at the entrance showing how many spaces are free. Staff now walk the floors twice a day and count by hand, which takes about 45 minutes each time.

The team mounts one camera per 20 bays, or 20 cameras in total, and a detector reports each bay as free or occupied every 30 seconds. On a test day with 400 bays, the system reports 120 free and 280 occupied, and a manual check finds 3 bays wrong: 2 reported free that are occupied, and 1 reported occupied that is free.

The arithmetic: 397 correct out of 400 is 99.25% accuracy, and 3 wrong bays means the sign is off by at most 3 spaces. The sign updates every 30 seconds instead of twice a day, and the 90 minutes of daily manual counting is freed for other work.

What are the common mistakes?

The most common mistakes in vehicle detection are mounting the camera badly, training on one kind of weather, and counting the same vehicle twice.

  • A camera angle that hides plates behind other vehicles, so tolling fails.
  • Training only on daylight images, so the system fails at night.
  • Counting without tracking, so one car becomes many counts.
  • Trusting plate reads without a confidence threshold, so a misread plate charges the wrong account.
  • Skipping the manual check in the first month, so small errors become habits.

Vehicle detection is forgiving when the scene is fixed and the question is simple. Keep the camera still, the question clear and a person in the loop for the first weeks, and the system will earn trust quickly.

Key takeaways

  • Vehicle detection finds, counts and identifies vehicles from fixed cameras
  • Tracking links boxes across frames so one car is counted once, with speed and direction
  • Plate reading is a separate step that needs a clear, well-lit plate image
  • Traffic, tolling, parking, enforcement and fleets all use the same core method
  • Start with the camera and the question, not with the model

Frequently asked questions

How accurate is vehicle detection?

On a fixed camera with a clear view, counting accuracy is often above 98% in daylight. Accuracy drops at night, in rain or when vehicles overlap, so teams test across weather and keep a person checking the counts for the first month.

Does vehicle detection need a special camera?

A standard camera works for counting, but plate reading needs a fast shutter and infrared light for night use. The camera angle matters more than the camera price: plates must be large and readable in the frame.

What is the difference between detection and tracking?

Detection finds vehicles in one frame, while tracking links the same vehicle across frames. Tracking is what stops one car being counted 30 times, and it is also what gives speed and direction.

Can vehicle detection read number plates?

Yes, with a second step. The detector finds the vehicle, the system crops the plate area, and optical character recognition reads the characters. A confidence threshold sends low-confidence reads to a person instead of charging the wrong account.

How long does it take to build a vehicle detection system?

A counting system on a fixed camera can be tested in a few weeks using a ready-made detector. Plate reading and enforcement take longer, because the camera setup, the rules and the review process need more care.

What data does a vehicle detection project need?

A week of footage covering day, night, rain and busy periods, plus a sample labelled by hand. Labelled examples of each vehicle type help, and the footage should come from the real camera position, not a demo clip.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building vehicle detection for roads, parking or fleets? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Computer Vision service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call