Shelves go empty long before the warehouse system knows it, and the cost lands at the shelf edge. A depth camera bolted over the bays answers the question directly, because it measures occupied space instead of recognising products. You set one region of interest per bay, capture the empty shelf once, and let a 70% pixel rule raise the alarm. This guide gives you the algorithm, the three numbers that tune it, the mount arithmetic that sizes the camera count, and the two cases where printed markers or a trained detector beat the depth approach.
Can a depth camera detect an empty shelf?
Yes — capture a depth map of the bay while it is empty, then alarm when at least 70% of the region's valid pixels read within 25 mm of that reference for three straight captures, because stocked goods always sit closer.
The reason it works: depth measures space, not appearance. Packaging redesigns, dark blister film, own-brand versus brand variants — none of it matters, because a filled bay occupies volume and an empty one does not. No depth SDK ships a ready-made shelf function; you build the comparison from raw depth values, and it fits in a page of code. The colourized image in viewer tools is a display ramp for humans, so run the decision on the numbers and never on the colours.
The same sensor family that counts people and room occupancy drives this job, and the 3D sensor guide for occupancy-style detection compares the sensor types.
How does the depth-reference method work?
Work on raw depth values rather than the colourized preview: store a reference depth image R of the empty bay, mark one region of interest per bay, and classify every valid pixel as matched within 25 mm of the reference or stocked at 100 mm or more in front.
The pipeline has five stages:
- Draw one region of interest polygon per bay, covering the merchandise volume and excluding the shelf edge, the front lip and all structure.
- Capture the reference with the bay empty: average 20 frames into R and log the median depth per bay.
- On every cycle, read the live depth image and count matched pixels, stocked pixels and invalid pixels.
- Compute the empty fraction over valid pixels only.
- Hold the result for three frames and apply hysteresis before reporting.
Most SDKs can crop acquisition to a window before data reaches your code; the depth camera ROI configuration guide walks one worked set-up. The reference plane itself carries edge error near depth discontinuities, and quantifying flat-plane distortion gives you the test that sizes the match band honestly.
Where do you set the band, the offset and the alert fraction?
Start at a ±25 mm match band, a 100 mm stock offset and a 70% empty fraction. Twenty-five millimetres is roughly twice the 5-12 mm noise an indoor depth sensor shows on a matte shelf at 1-2 m; 100 mm clears it with margin.
Set the band from your own capture: the standard deviation of the 20 reference frames, times two. Matte indoor bays usually land between 5 and 12 mm, so the band lands between 10 and 25 mm; glossy shelf liner or a vibrating bracket pushes it up, and the drift check below tells you when.
The 100 mm offset does two jobs. It sits 4-8× above the band, so sensor noise cannot fake stock, and it marks the shallowest packaging you accept as present. Set it to the front-to-back depth of the thinnest facing you count: a slim bar pack can present as little as 50 mm, so 100 mm keeps slack. For pallet presence in racking the same logic pushes the offset to 300 mm.
The 70% fraction encodes the alarm's meaning: essentially bare. One stray facing covers a few percent of the region and will not hold a bay open, while a bay one-third filled trips the alarm, which is normally the restock point you want. Use 50% for an earlier half-empty warning, or 85% if staff only want bare-bay calls.
What can one camera see from a given mount?
Assume a representative 87° × 58° depth field of view at 1.5 m stand-off: coverage runs 2 × 1.5 × tan 43.5° = 2.85 m wide and 2 × 1.5 × tan 29° = 1.66 m tall, so one camera per pair of 0.9 m shelf levels fits with margin.
Read the field of view from the sensor you shortlist and rerun the two lines below; 87° × 58° is a common wide depth field, not a constant.
Noise, not pitch, limits the stand-off: stereo-style error rises roughly with the square of distance, so a sensor comfortable at 1.0 m needs a wider band at 2.0 m. Keep shelf work in the 1.2-1.8 m range, mount above the watched levels and tilt down 30-40° so pixels see product faces rather than only shelf tops. The 3D camera working distance and positioning guide covers the rest of the geometry. Depth emitters are Class 1 infrared sources under IEC 60825 / IEC 62471: safe in normal use, so do not defeat the window or stare into it from centimetres away.
If you would rather check the pixel budget than do the division, the calculator below turns coverage and accuracy into a pixel count.
When are fiducial markers the better choice?
Move to printed markers when the mount cannot be guaranteed rigid. A tag at the back of each bay reads "empty" whenever the camera can see it, tag detection doubles as an aim check after a knock, and the same trick works from a moving device.
ArUco- and AprilTag-style prints are the usual families, and the logic inverts: a visible tag means the stock that should cover it is gone. The method is immune to camera drift because every frame re-localises against the tags, and it runs on any camera — a colour smart camera needs no depth at all. Size the print so the tag holds enough pixels; the fiducial marker pixel size guide gives the thresholds that keep detection stable.
Two failure modes need designing out. A single pack in front of the tag reports the bay stocked while the rest stands bare, so mount tags high on the back wall or fit two per bay at different depths. A faded or peeled tag reads empty forever, so add tag presence itself to the drift check. Tags arrive on the colour image, so lighting matters here in a way it does not for depth — controlling ambient light variation covers the fixes. One camera can serve both checks at once; feeding depth and tag detection from one stream shows how.
Depth threshold, markers or a trained detector — which wins when?
For a fixed camera and a stocked-or-empty alarm, the depth reference wins: one capture per bay, no printing, no training images, and it ignores packaging design. Markers win when the mount drifts or the camera roams; a trained detector wins only when you must count facings or audit planograms.
| Depth reference | Fiducial markers | Trained detector | |
|---|---|---|---|
| Set-up per bay | one empty capture | print and place tags | labelled images per layout |
| Survives SKU and artwork changes | yes | yes | retrain |
| Camera nudged or moved | re-capture the reference | re-localises by itself | re-check the aim |
| Camera on a moving device | no | yes | yes |
| Output | bare or stocked per bay | bare per tag | facings per SKU |
| One pack hides the sensor | no | possible false "stocked" | no |
| Runs on | depth sensor plus host code | any camera | smart camera or GPU host |
Per case:
- Vending rows and case shelves, fixed camera: depth reference, 100 mm offset, 70% fraction.
- Pallet presence in racking: same method, offset raised to 300 mm.
- Aisle-audit trolley: markers for the bare-bay call; add a detector later if facings matter.
- Planogram or share-of-shelf reporting: trained detector on a smart camera, one labelled-image effort per layout.
If the open question is 2D versus 3D in general, 2D or 3D camera for conveyor pick and place works the same trade in a pick-and-place setting.
How do you commission the alarm and keep it honest?
Commission in five steps, about an hour per aisle: rigid mount, region polygons, an empty reference averaged over 20 frames, a walk-test with a dummy pack, and a daily drift check that flags re-capture when the median depth moves more than 10 mm.
- Mount. Bolt the camera to the shelving frame through a stiff bracket at 1.2-1.8 m, tilted 30-40° down. A hand-held cantilever vibrates and widens your band.
- Regions. Draw one polygon per bay on the live depth image, hugging the merchandise volume and excluding edges and the front lip.
- Reference. Empty the bays, average 20 frames into R, and log each bay's median depth (example: 1.50 m) and standard deviation — the deviation sets the match band.
- Walk-test. Bay empty: the matched fraction should read 85-95% and latch the alarm after three frames. Fill half a bay: the fraction should fall below 50% and clear. A single 90 mm × 150 mm facing covers about 20 × 33 = 660 pixels of a 16,000-pixel region — 4% — so one facing never clears the alarm; if the semantics demand "any stock", invert the rule and alarm when the stocked fraction falls under 3%.
- Drift. Compare each bay's live median with the stored baseline once a day; more than 10 mm of movement means the camera or shelf has shifted, so re-capture. After any knock, re-capture and repeat the walk-test.
Multiple cameras per aisle are normal, and selecting each depth camera by serial number keeps captures attributed to the right bay. If medians wander between frames, work through troubleshooting stereo depth jitter before widening the band — a wide band hides a mounting problem.
Which parts fit the build?
For the depth route pick a dedicated 3D sensor: a ToF sensing camera such as the MV-DT01WMU for wide bays, or a projected structured-light camera such as the MV-DPS200P-02 for tighter indoor bays. For the marker or detector route, a smart camera runs the whole check on the device.
Structured light pays off where the bay sits at a fixed short stand-off and you want the tighter noise floor; ToF covers more bay from a higher mount. On the detector route, the MV-SC6050C-08M-XBN pairs a 5 MP colour sensor with an 8 mm lens and runs its detection on the device, so the aisle stays free of extra hardware.
- Type
- Depth / ToF camera
- Type
- Stereo / structured light
- Interface
- GigE
- Resolution
- 5 MP
- Sensor format
- 1/1.45"
- Shutter
- Global
Browse the full range on the 3D sensors category page or the camera finder, or start the configurator at the camera step below.
The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.
Send bay width, level count and stand-off through the contact page and we will return a camera count, region plan and parts list; multi-aisle rollouts price through the quote page. The rest of the depth-camera geometry lives on the 3D vision topic page.
Questions
How far from the shelf can the camera sit?
For stereo and structured-light sensors, hold the stand-off between 1.2 and 1.8 m: their noise grows quickly with distance, and beyond about 2 m the ±25 mm band stops being honest. ToF sensors tolerate longer stands; size the band from the sensor's noise specification at your actual distance, or measure it from a 20-frame reference capture on site.
What about a glass-fronted chiller or vending case?
Glass returns infrared to the sensor, so pixels can read the pane instead of the stock and validity collapses. Mount the camera inside the case where the layout allows, mask the reflection band out and rely on open-front pixels, or switch to the marker method: a printed tag behind the glass reads perfectly from a colour image, which is why it is the default for glass-front vending.
Can the system flag a half-empty bay rather than a bare one?
Yes — lower the alert fraction from 70% to 50% and the alarm moves from 'essentially bare' to 'roughly half empty'; at 30% it calls any bay missing a third of its front. Keep the three-frame hold, and expect more daytime nuisance calls, because every handled gap in the front row reads as changed pixels.
How often does the empty reference need re-capturing?
Only when geometry changes, not when stock or artwork changes. The reference describes surfaces, so restocks and new packaging need nothing. Re-capture after the camera is moved or nudged, after the shelf is rebuilt or re-slotted, and whenever the daily check shows the median depth drifting more than 10 mm from the stored baseline.
Do the alarms survive a dark store or a blacked-out case?
Yes for the depth route: the sensor carries its own infrared illumination and needs no ambient light. Direct sun on the bay is the real limit — strong ambient infrared can swamp the projected pattern — so shade south-facing glass. The marker route reads the colour image and does need light, which is one more reason to keep it indoors.


