People counting with CCTV: how it works and how accurate it is

CCTV people counting detects people in each frame, tracks them, and counts line or zone crossings; accuracy depends on angle, crowding and light, so test it.

By CloudOEngine.ai Engineering · · 10 min read

Short answer: CCTV people counting runs a computer vision model on the camera stream that finds every person in each frame, follows each one across frames as a track, and adds to the count when a track crosses a virtual line or enters a zone. How accurate it is depends mostly on the scene, not the software: a camera looking down on a well-lit doorway can count very well, while crowded, low-angle or dark scenes miss and double count people. The only accuracy figure worth trusting is one measured on your own cameras against a careful hand count.

What is CCTV people counting used for?

People counting turns a video feed into numbers a business can act on. Instead of someone watching a screen with a clicker, software counts the people who pass a point or stand in an area.

Typical uses:

  • Footfall: how many people entered a store, mall, branch or museum, by hour and by day.
  • Conversion: visitors compared with transactions. As an illustration, a store with 1,200 entries and 300 bills in a day has a 25% conversion rate.
  • Occupancy: how many people are inside a space right now, for safety limits or crowd management.
  • Queues and staffing: how long lines get at counters, so rosters match demand.
  • Space use: which floors, zones or meeting rooms are actually used.

The appeal of using CCTV is that the cameras are often already installed. The catch is that security cameras are placed to identify faces and cover wide areas, which is not always what a counter needs. More on that below.

How does CCTV people counting work?

Almost every video counting system follows the same pipeline. Each stage feeds the next, so an error early on becomes an error in the count.

Camera streamdecoded framesDetect peopleboxes per frameTrack IDsIDs over timeCount logicline or zoneKPIfootfall by hourHuman reviewuncertain crossingsAccuracy depends on the sceneangle, light, crowding, stream quality
The CCTV people counting pipeline. Each stage passes its errors on; uncertain crossings are best sent to a person before they reach the KPI.
  1. Read the stream. The software pulls video from the camera or recorder and decodes it into individual frames. Some systems process only some of the frames to save computing power.
  2. Detect people. A detection model draws a box around each person it finds in a frame, with a confidence score.
  3. Track them. A tracker links boxes across frames so the person in frame 10 keeps the same ID in frame 11. Without tracking, you could count how many people are in a picture, but not how many walked through a door.
  4. Apply counting logic. Rules decide what counts: a track crossing a line in a given direction, a track entering a zone, or the number of tracks inside a zone at a moment.
  5. Review the doubtful cases. Crossings the system is unsure about can go to a person to confirm or reject.
  6. Aggregate into KPIs. Counts are grouped by entrance, hour, day and site, and joined with other data such as sales or staffing.

Tracking deserves a closer look, because it is where many counting errors start. A common approach is to keep only detections above a confidence threshold. The authors of ByteTrack point out that this throws away people who are partly hidden, because occluded people tend to get low scores. Their method instead tries to match almost every detection, using the low-score boxes to continue existing tracks while filtering out background. They report it consistently improved the IDF1 identity score, by between 1 and 10 points, when applied to nine existing trackers. In plain terms: how a tracker handles partly hidden people changes how often one person turns into two.

Which counting method fits which scene?

There are three main ways to turn video into a count. They answer different questions.

Method What it measures Best for Weak spot
Line crossing Entries and exits, with direction Doorways, gates, corridors People lingering at the line; groups walking side by side
Zone occupancy People inside an area right now Rooms, queues, floor areas People hidden behind shelves or other people
Density estimation Estimated total in one image Very dense crowds, events, platforms No individual tracks, so no entries or exits

Line crossing and zone counting both depend on detecting and tracking individuals. That breaks down when people are packed together. Density estimation takes a different route. In a well-known 2016 paper, Zhang and colleagues trained a network to map a single image to a density map, where the values over an area add up to the number of people in it. Their ShanghaiTech dataset contains 1,198 images with 330,165 people annotated at the centre of their heads. The paper notes that occlusion in a clustered or very dense crowd "significantly affects the performance" of detection-based counting, which is the gap density methods fill.

For most businesses, line crossing at entrances is the core method. Occupancy is either counted directly in a zone or calculated as entries minus exits, which drifts over the day if errors build up, so it is worth resetting at closing time.

Where should the camera go?

Camera placement decides more about accuracy than model choice. These are practical rules of thumb, not a standard:

  • Look down, not across. A camera above the doorway looking down sees the tops of heads and shoulders, which rarely overlap. A camera at head height looking across a doorway sees people stacked one behind another.
  • Keep the counting area away from where people stop. Put the line a few steps inside the entrance, past where people pause, hold doors or chat.
  • Make people big enough. A person who covers only a few pixels at the far edge of a wide security view is hard to detect, especially on a compressed stream.
  • Avoid harsh backlight. A glass door with bright daylight behind it can turn people into silhouettes. Check the scene at the brightest and darkest hours you will count.
  • Cover the whole width. If people can walk around the edge of the camera's view, they will not be counted.
  • Check the real stream. The detail the model sees depends on the bitrate and resolution of the stream it receives, not the camera's specification.

If your existing cameras fail these tests, one extra camera placed for counting is often cheaper than months of unreliable numbers.

How accurate can CCTV people counting be?

There is no honest single figure, because accuracy is a property of a camera, a scene and a time of day, not of a product. Research benchmarks show why.

Crowding is the biggest factor. The CrowdHuman dataset was built to study detection in crowds; it averages about 22.6 people per image, with many kinds of occlusion. The MOT20 tracking benchmark went further: its sequences are filmed from an elevated viewpoint and reach a mean density of 246 pedestrians per frame, which its authors describe as 10 times denser than the first release of the benchmark. These datasets exist precisely because crowded scenes remain hard.

Even strong trackers are not perfect on benchmarks. ByteTrack, a widely cited tracker, reports 80.3 MOTA, 77.3 IDF1 and 63.1 HOTA on the MOT17 test set. These scores combine misses, false detections and identity errors across whole videos, so they do not translate directly into a counting error rate. But they show that tracking pedestrians in busy public scenes still produces errors even for leading methods.

Your site is not a benchmark. A single doorway with a top-down camera is a much easier problem than a busy street. A wide-angle security camera covering a crowded atrium at night is a harder one. The table below sets out what tends to happen; it describes direction, not measured figures.

Scene What to expect
Overhead camera, single doorway, steady light Few errors; mostly groups entering together
Angled camera at a doorway More misses when people walk one behind another
Wide security view of an open floor Small, distant people missed; occlusion behind fixtures
Dense crowd at an event or platform Individual tracking breaks down; consider density estimation
Night, glare or heavy compression Missed detections rise, broken tracks cause double counts

Two error types matter, and they pull in opposite directions. Misses push the count down. Double counts, often from a track breaking and restarting, push it up. A daily total can look right while both are happening, which is why our article on video analytics accuracy argues for matching each counted crossing against a hand count rather than comparing totals.

How do you test people counting on your own cameras?

Before anyone uses the numbers, measure them. A practical acceptance test:

  1. Pick sample periods for each camera: quiet and busy hours, day and night, and any special conditions such as rain or a weekend rush.
  2. Count by hand from the recorded footage, noting each entry and exit with its time and direction. Have a second person check disputed cases.
  3. Match each AI-counted crossing to a hand-counted one within a short time window. Unmatched AI counts are false positives; unmatched hand counts are misses.
  4. Report precision and recall per camera, not one figure for the whole site. A single poor entrance can hide behind good ones.
  5. Fix the worst camera first. Usually that means moving the counting line, changing the angle, or adding a camera, not changing the model.
  6. Repeat after changes and on a schedule. Lighting, store layouts and seasons change, and so does accuracy.

Write the accuracy figures down next to the counts. A footfall report that says how it was checked is far more useful in a meeting than one that does not.

What about privacy and the law?

This section is general information, not legal advice. Check the rules that apply to your sites with a qualified adviser.

Counting does not require knowing who anyone is. A counter needs to find a person and follow them for a few seconds; it does not need faces, names or identity. Designing for that makes privacy easier:

  • Keep counts, not identities. Store the numbers and, where you need them for review, short clips under the same controls as your other CCTV footage.
  • Do not add facial recognition for counting. It adds risk without improving the count.
  • Set retention periods for footage and review clips, and stick to them.
  • Control access. Only the people who need footage or review queues should see them, and access should be logged.
  • Tell people. Signage and privacy notices should cover how camera footage is used.

Regulators treat CCTV footage as personal data. The UK Information Commissioner's Office, for example, publishes guidance on video surveillance that says the public must have confidence that surveillance is "lawful, fair, transparent". At the time of writing, the ICO notes that this guidance is under review following the Data (Use and Access) Act. In India, the Digital Personal Data Protection Act applies to digital personal data; see our overview of AI governance in India and the DPDP Act.

What are the common mistakes?

  • Reusing security cameras without checking the view. A camera chosen to identify faces at the till is rarely the right one to count the door.
  • Counting at the threshold. People stop in doorways, so counts jitter there.
  • Reporting only totals. Misses and double counts cancel out on good days and not on bad ones.
  • Ignoring staff. Staff movements inflate footfall unless they are excluded or estimated, and the method is written down.
  • Testing only in daylight. Evening and night footage often behaves very differently.
  • Calculating occupancy from entries minus exits all day without a reset, so small errors accumulate.
  • Never re-testing. A new display stand, a moved door or a firmware update can change accuracy overnight.

How CloudOEngine helps

CloudOEngine's Vision AI is designed so a people count comes with its evidence.

Each count is produced by two independent trackers. Where they agree, the crossing is counted. Where they disagree, the case goes to a human review queue, where your own staff check it and decide. That puts human attention on exactly the crossings most likely to be wrong: the groups, the occlusions and the people lingering at the line described above.

When a count is finalised, it ships with a published accuracy report, and every counted crossing is shown, so anyone who questions a footfall number can see what it is made of.

Camera streams connect on the same platform as your databases and files, alongside pipelines, the AI runtime and live video, with one permission model and one audit trail. That means footfall can sit next to sales or staffing data without stitching tools together, and AI can read your real data schemas to propose KPIs.

Governance is included, not upsold: tenant isolation, role-based access, audit logs and per-tenant encrypted secrets, which matters when the input is camera footage.

CloudOEngine is built in Bengaluru, India.

Book a demo ยท See Vision AI

Frequently asked questions

How does CCTV people counting work?

Software reads the camera stream, detects each person in every frame, links those detections across frames into tracks, and adds one to the count when a track crosses a virtual line or enters a zone. The counts are then grouped by hour, day or location to become footfall or occupancy figures.

Can I use my existing CCTV cameras for people counting?

Often yes, if the camera sees the entrance or area clearly, the people are large enough in the frame, and the stream quality is reasonable. Cameras mounted for security, looking at faces from a low angle, usually count less well than cameras looking down on a doorway.

How accurate is CCTV people counting?

There is no single figure. A clear overhead view of a doorway with steady light can count very well, while a crowded, low-angle or badly lit scene will miss and double count people. The only reliable number is one measured on your own cameras against a hand count.

What is the difference between line counting and crowd density estimation?

Line counting follows each person and counts them when they cross a line, so it gives entries and exits. Density estimation looks at a single image and estimates how many people are in it, which works in very dense crowds but does not tell you who came in or went out.

Does people counting need facial recognition?

No. Counting only needs to find a person and follow them for a few seconds; it does not need to know who they are. Keeping counts rather than identities also reduces privacy risk, though camera footage is still personal data in many jurisdictions.

Should staff be excluded from footfall counts?

Usually, yes, because staff walking in and out inflate visitor numbers. Common approaches are counting only during opening hours, using a separate staff entrance, or subtracting a measured staff share, and the method you choose should be written down with the numbers.

Sources

  1. Single-Image Crowd Counting via Multi-Column Convolutional Neural Network (Zhang et al., CVPR 2016)
  2. CrowdHuman: A Benchmark for Detecting Human in a Crowd (Shao et al., 2018)
  3. MOT20: A benchmark for multi object tracking in crowded scenes (Dendorfer et al., 2020)
  4. ByteTrack: Multi-Object Tracking by Associating Every Detection Box (Zhang et al., 2021)
  5. Guidance on video surveillance (including CCTV) (UK Information Commissioner's Office)

#people counting #cctv #video analytics #footfall #computer vision