ApplicationsExplainer

Single camera person detection with occlusion: HOG plus tracking

How single-camera person detection handles partial occlusion: the HOG detector, a tracker, the pixel and exposure budgets, and when depth wins.

LumaSpec Vision11 min read Share on LinkedIn

On this page 9 sections
  1. 01The pipeline: detect, then bridge the gap
  2. 02The pixel budget: 128 rows on the person
  3. 03Worked example: a 1.7 m person at 8 m
  4. 04Exposure, frame rate and shutter
  5. 05Where the single camera fails, and the fix
  6. 06When depth is the better sensor
  7. 07Three hardware routes
  8. 08Checks before you commit
  9. 09Questions

Locating one person in a room from a single camera — a position you can act on, not just a presence flag — is a solvable monocular problem once you accept its limits. The working recipe pairs a HOG-SVM person detector with a tracker that predicts through short occlusions: the detector fires whenever enough of the body is visible, and a particle filter carries the estimate across a shelf, a door frame or a passing colleague. This page gives the pixel, exposure and frame-rate budgets that decide whether one camera is enough, the published accuracy figures that calibrate expectations, and the failure modes — texture false triggers, long blind spots, darkness — each with its fix or its depth-camera replacement. It is written for integrators adding presence and position awareness to a room, cell or bay.

The pipeline: detect, then bridge the gap

The detector is the mature part. HOG summarizes image gradients over a sliding window and a linear SVM scores each window; OpenCV ships this as a pre-trained person detector whose defaults are documented, trained on public standing-pedestrian images such as the INRIA Person dataset. Nothing needs training to get a first result. The shipped model finds standing adults at the scale it was built for, and an image pyramid (detectMultiScale in the API) covers people nearer and farther than that scale.

Calibrate expectations from published studies rather than vendor slides. Benchmark reports on HOG-SVM pedestrian systems put detection above 95% accuracy at over 30 frames per second; one heavier pipeline that used HOG only as a region proposal averaged 0.7 s per image at 98% accuracy. The spread is the lesson: your frames, your threshold and your hardware give their own numbers. Clutter is where the method bends — in one comparative study under complex backgrounds, plain HOG measured 45.93% accuracy against 21.45% for Haar features.

Detection has no memory; the tracker is the memory. A particle filter holds a few hundred weighted position hypotheses, pushes them forward with a constant-velocity model and re-weights them against every detection. When occlusion blocks the detector, the hypotheses coast on prediction; when the person re-emerges, the surviving hypotheses capture the new detection and the track continues. If no re-detection arrives within your bridge window, the track dies and the next detection starts a new one. Counting a crowd is a different problem with different sensor choices — the ceiling-camera people-counting guide takes that route.

The pixel budget: 128 rows on the person

OpenCV's default detection window is 64 pixels wide by 128 tall. The rule that follows is simple: the standing person must project to at least 128 pixel rows of height at the farthest point you care about. Below that, every frame needs upscaling before detection — compute multiplies and the gradients the descriptor lives on soften. At or above it, you can downscale freely to buy speed.

rows_needed = 128 px × (vertical coverage at target) / (person height)

The coverage is the scene height your framing captures at that distance: floor to just above the head for a level wall-mounted camera, far more for a steep overhead tilt. Work it out from field of view and distance, or size it with the camera resolution calculator, which filters area scan cameras to sensors with the rows you need.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Worked example: a 1.7 m person at 8 m

The inputs, with their sources:

  • Person height: 1.7 m — median standing adult; design span 1.5 m to 1.9 m.
  • Distance: 8.0 m from a wall-mounted camera looking roughly level at the far zone of the room.
  • Vertical coverage at that distance: 2.5 m, floor to just above head height.
  • Detector requirement: 128 rows on the person, from the documented 64 × 128 window.
  • Walking speed: 1.4 m/s, typical adult pace (range 1.2 m/s to 1.5 m/s).
  • Target frame rate: 30 fps.

The rule in words: turn the pixel requirement into a scene scale — pixels per metre at the target — then check sensor rows against the coverage, and reuse the same scale to bound blur and frame-to-frame motion.

Scale at the target: 128 px ÷ 1.7 m = 75.3 px/m, so one pixel spans 1000 ÷ 75.3 ≈ 13.3 mm of scene at 8 m.

Rows needed: 75.3 px/m × 2.5 m = 188 rows. A 720-row sensor carries 720 ÷ 188 ≈ 3.8× the budget; a 5 MP sensor with 1944 rows carries 10.3×.

Person height on that 5 MP sensor at full resolution: (1944 ÷ 2.5) × 1.7 = 1322 px — 10.3 times the detection window. An 8× downscale to save compute still leaves 165 px on the person, clear of the 128 requirement.

Motion blur at the operating scale, defined here as the person at 140 px tall so one pixel spans 1700 mm ÷ 140 ≈ 12.1 mm: a walker at 1.4 m/s smears 1400 mm/s × 0.010 s = 14 mm ≈ 1.2 px during a 10 ms exposure, and 0.6 px at 5 ms. Exposure budget: 10 ms.

Frame-to-frame motion at 30 fps: 1400 mm/s ÷ 30 ≈ 47 mm ≈ 4 px per frame at the operating scale. A search gate of half a body width, about 20 px, tolerates five frames of pure prediction — longer once the velocity model earns trust.

Decision: at room scale the pixel test never decides the build, because even 720 rows pass with margin — spend on frame rate, shutter quality and light instead of resolution. The binding numbers are the 30 fps stream and exposure at or below 10 ms. What moves the budget is tilt, not distance: double the vertical coverage at the far point and you double the rows needed, so 5 m of coverage asks 376 rows. The test fails only when coverage grows past rows ÷ 75.3 — a 1080-row camera fails beyond about 14.3 m of scene height at the far point, which is a steep overhead view in a tall bay, not a room wall. That result is the signal to re-aim the camera or add depth.

Exposure, frame rate and shutter

Exposure first: hold it at or below 10 ms for people on foot and at 5 ms when they carry loads or turn sharply, because blur grows in proportion to shutter time at a fixed scale. Frame rate second: 30 fps keeps prediction gaps near 4 px at the operating scale, 15 fps doubles that and stays workable for a single walker, and below about 10 fps the match between detection and track needs real care. Shutter type last: a global sensor is the safe choice when people sweep across the view or the camera itself moves. At a 10 ms exposure and walking pace, a rolling-shutter frame distorts a person by only a few pixels.

Where the single camera fails, and the fix

False triggers on vertical structure. HOG responds to anything body-sized with body-like contrast: coat racks, open door frames, rack uprights, trolleys. Softening the detector threshold trades those false triggers for missed people — the cluttered-background study above shows how far that can go. Fix it with a 24-hour threshold tally, a geometric filter on person-like aspect ratio and floor contact, and the false-positive reduction guide.

Blind spots beyond about a second. At 1.4 m/s a person ends up 1.4 m from a one-second-old prediction. Past roughly 0.5 s to 1 s of full occlusion, plan for re-acquisition rather than tracking. If the room has a long blind zone, angle in a second camera or move to depth.

Darkness. A 10 ms exposure needs real light; a dim room buries the gradients in noise. Add illumination: a mono sensor with 850 nm or 940 nm IR keeps the room visually dark for people while restoring detection. Choose IR illuminators specified to the photobiological safety standard IEC 62471 — 850 nm shows a faint red glow, 940 nm is effectively invisible. To measure how noisy the frames actually are, the single-image SNR guide gives the estimate from one frame.

Poses the model never saw. The shipped detector is a standing-pedestrian model; seated, crouched and habitually hidden people under-detect. The occluded-object training-data guide covers building data for those cases.

When depth is the better sensor

Depth changes the physics of the problem. The test stops being texture and becomes geometry: a connected region about 1.7 m tall standing on the floor plane is a person in a coat, in shadow or against a rack. The classic monocular false triggers fail the height and floor-contact test, and active structured-light or time-of-flight sensors carry their own illumination, so darkness stops mattering too. Two checks come first. The close-range blind zone: stereo geometry needs a minimum working distance, and why a 0.2 m minimum range breaks person detection shows the failure mode. And surfaces that reflect or absorb the projected pattern, which scramble depth data locally. The 3D sensor selection guide for person detection walks the choice sensor by sensor.

For the depth route, a projected structured-light camera built for indoor volume work:

3D sensorsHikrobot MV-DPS200P-02 Projected structured-light 3D cameraMV-DPS200P-02
Type
Stereo / structured light
$8,829.00 · quotedView and quote

Three hardware routes

PC plus a 2D camera. The worked example's route: the camera streams frames, a PC runs detection and tracking, and results go to the PLC. The pick with the most scale headroom:

Area scan cameras12 MP USB3 area scan camera, IMX226, 1/1.7" rolling shutter, 30 fps, 4000 × 3000 resolution (LS-CMR-0166)LS-CMR-0166
Sensor format
1/1.7"
Interface
USB3
Resolution
12 MP
Shutter
Rolling
$560.00View partBuild a system with it

Its 4000 × 3000 frames at 30 fps over USB3 carry the 10× pixel margin from the example and leave room to widen the coverage later. Hold exposure at or below 10 ms. At that shutter time, rolling-shutter distortion on a walking person stays within a few pixels.

On the device. A vision sensor runs the model itself and ships coordinates instead of video — the route the smart cameras group is built around. This 5 MP global-shutter sensor suits it:

Smart cameras & vision sensorsHikrobot MV-SC3050XC-16M-ATN-H 5 MP color vision sensorMV-SC3050XC-16M-ATN-H
Interface
Fast Ethernet
Resolution
5 MP
Sensor format
1/1.45"
Shutter
Global
$1,809.00View part

Only results cross the Fast Ethernet link. What fits on the device, and whether you want a learned model or a rule-based pipeline at all, is covered in the custom detection models on embedded smart cameras guide and the AI versus rule-based smart camera guide.

Global shutter when motion turns harsh. Fast crossings, or the camera itself on a dolly or pan unit:

Area scan camerasHikrobot MV-CU020-90GC 2.5 MP Area Scan Camera, GigE, GMAX4002, ColorMV-CU020-90GC
Sensor format
1/1.7"
Lens mount
C-mount
Interface
GigE
Resolution
Up to 3 MP
$309.00View partBuild a system with it

Its 2.5 MP sensor clears the room-scale pixel budget with several times margin, the global shutter removes skew entirely, and GigE keeps the wiring simple.

Depth. The route of the previous section — a 3D sensor in place of a second guess at geometry.

Checks before you commit

  • Measure the farthest point and the coverage. Recompute the rows with the formula above using the real framing. Coverage, not distance alone, sets the budget.
  • Benchmark 30 fps end to end. Camera, link, detection, tracking, output. The published 30 fps figures are detector-only; your pipeline can be slower.
  • Shoot a walker at the working exposure. Blur should stay near 1 px at the operating scale — motion blur fails a build before resolution does.
  • Log a full day at the final threshold. Count false triggers and misses. A threshold tuned on five minutes of footage fails in a lived-in room.
  • Script the occlusions. Walk 0.3 s, 0.5 s and 1.0 s behind cover and check re-acquisition each time. The bridge window should be a measured number.
  • Define the dead-track behavior. Decide what the system reports when a track dies, because silence reads as a person vanishing.

Sized the budgets and picked a route? Start the configurator at the camera step or browse the camera finder. With a room sketch and the farthest working distance, contact us and we will check the numbers against your floor plan. More field setups sit on the applications topic page.

Questions

How can a single camera estimate distance to a person?

By scale, not timing. With the focal length expressed in pixels f and the measured person height h in pixels, distance Z ≈ f × 1.7 m ÷ h. The estimate inherits the height error: read the person as 128 ± 10 px at 8 m and the range moves by roughly ±0.6 m, because Z scales with the inverse of h. Treat monocular ranging as indicative only; a depth camera measures distance directly and keeps doing so when half the body is hidden.

Does person detection work in a dark room?

Only if the sensor receives enough light during its exposure — at 10 ms a dim room buries the gradients in noise. Mono sensors paired with 850 nm or 940 nm IR illumination restore detection while keeping the room visually dark, and structured-light or time-of-flight depth sensors project their own signal and need almost none. Specify IR illuminators to the IEC 62471 photobiological safety standard and measure the resulting image quality instead of trusting a live preview.

Why does a depth camera remove the false positives?

Because the test becomes geometric: a person is a connected region about 1.7 m tall standing on the floor plane, whatever the lighting or clothing. Coat racks, door frames and trolleys fail the height or floor-contact test no matter how body-shaped they look in a 2D frame. Active depth sensors also carry their own illumination, so the false triggers that darkness produces for a 2D detector disappear with it. Check the minimum working distance and surface reflectivity first.

What happens when a person stays hidden longer than a second?

Plan for the track to die. A constant-velocity prediction drifts as soon as the person turns or stops; after one second at 1.4 m/s they can sit more than a metre from any predicted point. A sound design drops the track at a measured bridge limit, reports location unknown rather than a stale position, and re-acquires on the next clean detection — or adds a second viewing angle so no blind spot fully covers the person.