A dark puddle under a flange proves nothing: standing shadows, grease patches, old residue and dropped rags all read as fresh oil to an RGB model, which is why appearance-only pipelines in engine rooms alarm all night. The fix is not a better appearance model; it is a different test. The chain below registers each frame so vibration stops moving pixels, gates candidates inside masked ROIs, treats occlusion as unknown rather than pass, and confirms a leak only when wetted area grows at a measured rate over minutes. You get the growth-rate formula, a worked alarm threshold for a 250 mm flange ROI at 20 fps, the camera and lighting roles, and the cases where the growth test itself fails.
Why one frame can never confirm a leak
Under engine-room LEDs, fresh oil, a shadow, a grease patch and a wet bolt all reduce to the same pixels: a dark region with a soft edge and maybe a sheen. Any model trained on appearance inherits that confusion, and a prompt-based matcher reproduces it, because the mimics genuinely match. The one property appearance cannot fake is growth: a live pool spreads, and nothing else on this list does.
| Candidate | Looks like oil | Area over five minutes | Gate result |
|---|---|---|---|
| Fresh pool | Yes | Grows steadily | Passes: leak alarm |
| Grease and old residue | Yes | Flat | Fails: no alarm |
| Equipment shadow | Yes | Flat, or swings with the lights | Fails: no alarm |
| Dropped rag | Yes | Jumps to full size, then flat | Fails: new-object notice |
| Person or tool | Occludes | Not measurable | Pixels unknown, clock paused |
| Condensation film | Partly | Rises and falls with heat cycles | Fails: not sustained |
Read the table as the design rule: appearance nominates candidates, growth delivers the verdict. The static versions of this failure sit behind oily-part false rejects in machining oil and false inspection rejects and behind why shadows fool static checks; the temporal gate below settles them once the scene moves.
The verification chain: register, gate, measure, confirm
Four stages sit between the RTSP stream and the alarm relay, and each removes one class of false positive outright.
- Register every frame. Warp each frame onto a locked reference of the scene, by phase correlation or features on static structure, and move the ROI masks with the same motion. Registration is what turns vibration from false change into a bounded error; the mechanism is the one in why pixel shifts change detection results.
- Nominate candidates only inside the ROI masks. Run background subtraction and segmentation per ROI, and let everything they find stand as a candidate, never as an alarm. Subtraction leaves contour artifacts behind, covered in image subtraction false defects; they cost nothing here because the gate ignores anything that does not grow.
- Measure area the same way every cycle. Fit the blob boundary sub-pixel instead of counting raw pixels; the counting method itself is in measure blob area by pixel counting. Consistency beats sophistication, because the gate compares areas across minutes.
- Confirm by growth and treat occlusion as unknown. Occluded pixels leave the state machine untouched while the rest of the ROI keeps testing. A person crossing the zone pauses nothing globally; a rag landing raises a new-object notice, not a leak timer.
A is wetted area in pixels or mm², dt the spacing between measurements in minutes, so g comes out as a fraction per minute: 0.02 per minute is 2 %/min. Alarm only when every one of five consecutive one-minute windows clears 2 %/min. That is sustained, near-monotonic spreading, and it is the one signature a shadow cannot produce.
Stabilizing a camera bolted to vibrating machinery
Your cameras are rigidly mounted to the bulkhead and share the machinery's vibration, with no accelerometer feed, so stabilization has to come from the frames themselves. Register against the locked reference, never against the previous frame: chained registrations accumulate drift exactly where you need stability.
The residual budget is one pixel, and the arithmetic shows why. The area error from a boundary shift is roughly the perimeter times the shift: on a 20 px-radius pool, 2π × 20 × 1 ≈ 126 px², about 10 % of the pool's 1,257 px² area and five times the entire 2 %/min window. Registration is not polish; without it the gate measures vibration, not oil.
Light shifts mimic scene change just as effectively. Fix exposure and gain manually and log them, and diagnose the mains-beat component with camera image flickers: causes and fixes before blaming the algorithm. The same discipline of constant light in every frame is what ambient light variation in pick and place vision applies to moving parts.
Worked example: alarm gate for a 250 mm flange ROI at 20 fps
The inputs, and where each comes from:
- ROI width 250 mm, the masking width you set for joints of this size.
- Framing: 500 px across that width, so the scale is 250 mm ÷ 500 px = 0.5 mm/px. Re-derive it for another ROI width with the camera resolution calculator:
- Stream: 20 fps, the middle of the plant's 15–25 fps RTSP feed; you evaluate one frame every 2 s and spend the rest on registration quality.
- Gate: 2 %/min in each of five consecutive one-minute windows.
- Test event: a slow drip grows the pool from 20 mm to 26 mm of diameter in five minutes.
The rule in words: a spreading pool is a disc, and the gate compares wetted areas, not diameters, because area is what the tracker reports. The arithmetic:
- A1 = π × (10 mm)² = 314 mm², which at 0.5 mm/px is r = 20 px and A1 = π × 20² = 1,257 px².
- A2 = π × (13 mm)² = 531 mm², which is r = 26 px and A2 = π × 26² = 2,124 px².
- g = (2,124 − 1,257) px² ÷ (1,257 px² × 5 min) = 867 ÷ 6,285 = 0.138 per minute = 13.8 %/min.
The smallest leak the gate can catch follows from the radius form:
At the floor, dA = 0.02 × 1,257 = 25 px² per minute, so dr = 25 ÷ (2π × 20) = 0.20 px/min, which is 0.10 mm of radius per minute, or about 1 mm of diameter every five minutes. Decision: the 13.8 %/min drip clears every window and latches the alarm at minute five; a shadow or a rag sits at 0 %/min and never clears it. If you also want drips in flight, a droplet falling 150 mm lands at √(2 × 9.81 × 0.15) ≈ 1.7 m/s, and freezing it to one pixel at 0.5 mm/px takes an exposure of 0.5 ÷ 1,700 ≈ 0.3 ms — a diagnostic mode, not part of the gate.
Cameras, light and housing for an engine-room ROI
The whole chain, registration through blob fits at one frame every two seconds, is light computation, so it runs on the camera itself. A smart camera keeps registration through verdict on the device, one box per ROI; the camera finder filters them by resolution and interface.
Mono suits this task, because the discriminating features are darkness, growth and specular response, not hue. The MV-SC5060XM-08M-WBN is a 6 MP mono smart camera with an 8 mm M12 lens on GigE.
- Interface
- GigE
- Resolution
- 6-10 MP
- Sensor format
- 1/2.4"
- Shutter
- Rolling
Where you want color as a weak prior, or a global shutter for the drip diagnostic, the MV-SC3050XC-16M-ATN-H provides 5 MP color with a global shutter over Fast Ethernet.
- Interface
- Fast Ethernet
- Resolution
- 5 MP
- Sensor format
- 1/1.45"
- Shutter
- Global
For tight ROIs where glare hides the pool edge, the LS-SMC-0063 integrates a 1.6 MP sensor, a 16 mm lens, a 60 fps readout and a polarized white light in one housing.
- Interface
- GigE
- Resolution
- Up to 3 MP
Engine-room LEDs flicker and work lights move, so give every frame identical light: fix exposure and gain, then strobe a fill lamp in sync with the camera so the controlled pulse, not the room, sets the exposure. The LS-CTL-0070 is a 4-channel digital control box rated 200 W with RS232 and a strobe feature.
- Output
- Constant voltage 24 V
- Channels
- 4 channels
- Control
- Digital
- Feature
- Strobe
Match channels and power to your lamps in the light-controller finder, or start the configurator at the controller step. Mounting matters as much as optics: a bulkhead camera lives in heat, humidity and salt-laden air, so house it in a sealed, corrosion-rated enclosure with glanded cable entries; the NEMA 4X versus IP66 ratings guide maps the two scales so the housing spec matches the sheet you buy from.
Keep learned models in the candidate role; the division of labor is laid out in AI vs rule-based smart camera inspection, and adding AI surface defect inspection to existing cameras shows how to bolt a candidate model on without touching the gate.
Specular sheen: score candidates with it, never confirm with it
A smooth oil film is a dielectric surface: at normal incidence it reflects ((1.5 − 1) ÷ (1.5 + 1))² ≈ 4 % of the light, and that share climbs toward mirror-like reflection at grazing angles, which is exactly how engine-room lamps sit relative to a vertical weep. Matte grease scatters light with no mirror image, and a shadow is the absence of light on an unchanged surface. The hardest mimics, matte dark marks on dark steel, are worked through in dark contaminant detection on dark surfaces.
Put the physics to work: run the fill in two states, strobed from a second position or polarizer crossed then parallel, and score each candidate by how far its highlight moves between states. A liquid sheen swings hard; a bolt or a grease patch barely shifts. That specular gain is a strong candidate score and a fast filter for fasteners and residue.
It is still not the verdict. A static sheen can be last week's leak, condensation, or any smooth film. Appearance answers what the mark looks like; only growth answers whether it is alive.
Where the growth gate fails, and the detector to switch to
- Sprays and mists never form a pool; droplets land in bursts and drift with airflow, so area reads as noise. Switch detectors: count arrivals, where one dark ellipse appearing over clean reference metal is one arrival, and alarm at three arrivals within ten minutes at a joint ROI.
- Wicking along a ledge grows area linearly and passes the gate as it should, because it is a real leak.
- Absorbent surroundings soak the pool until growth plateaus and the gate goes quiet by design. The catch is the new-object notice: a dark object that appears at full size beside a joint is a maintenance item for the shift, not an alarm.
- Condensation follows the room's heat cycles, rising on cooldown and shrinking on warm-up, so it fails a sustained gate over any five-minute watch. Log one cooldown on your own machinery to confirm that before arming.
- Wash-down changes every reflectance in the scene: re-shoot the reference and restart the state machines after cleaning. Keep auto modes off for good, because one automatic gain step reads as scene-wide change, the drift behind camera image brightness drifts over time.
Before you arm the alarms
- Log one week per ROI with the gate armed but silent, then set the alarm floor just above the largest growth rate normal operation produced.
- Measure residual registration error while the machine runs and keep it under 1 px; a 1 px shift already moves a 20 px pool's area by about 10 %.
- Walk each ROI with a person, a rag and a tool; expect unknown-pixel states and one new-object notice, never a leak alarm.
- Release a measured drip of the product oil at one flange, record the growth rate it produces, and compare it with the 13.8 %/min worked case.
- Confirm every exposure and gain in the chain is manual and logged.
- Agree the housekeeping rule in writing: a new static dark object at a joint is a notice, cleared within the shift.
The decision, per case
Pool leaks: gate at 2 %/min across five one-minute windows at 0.5 mm/px framing. Any pool-forming leak alarms within five minutes of steady spreading; shadows, grease, residue and rags fail by construction, because 0 %/min never clears the floor. Slow weeps stay detectable down to about 1 mm of diameter per five minutes. Sprays: switch to arrival counting, three in ten minutes at a joint. Occlusion: unknown pixels and a running clock on the rest, never a blanked alarm window.
Start with one ROI, log the week, then repeat the chain flange by flange. The applications topic page collects the neighboring techniques, and for a multi-camera engine-room layout send the ROI list through the quote desk or the contact page.
Questions
How fast does a real oil pool grow?
A slow drip on smooth steel gave 13.8 %/min in the worked case, growing 20 mm to 26 mm of diameter in five minutes. At the 2 %/min floor and 0.5 mm/px framing, a pool widening about 1 mm of diameter per five minutes still alarms. Sprays grow in bursts and drift with airflow, so count arrivals instead of area for them.
How long is the persistence window?
Latency equals persistence: with five one-minute windows the alarm latches about five minutes after steady spreading starts. Shorten to three windows only if someone acts on the alarm within that time; below three, partial condensation cycles start clearing every window and nuisance alarms return. The gate value itself stays at 2 %/min until your logged week says otherwise.
Does a color camera separate oil from shadow or water?
Not reliably under engine-room LEDs: oil, shadow and bilge water all darken the metal, and hue shifts with the light spectrum. Let color be a weak prior in candidate scoring only. Darkness, specular gain under a polarizer change and sustained growth carry the verdict; context, the ROI sitting at a flange, separates oil from water better than hue does.
Can the gate run on the plant's existing RTSP cameras?
The growth test itself can: it samples one frame every two seconds, well inside a 15–25 fps stream. What a plain RTSP feed blocks is the rest of the chain: manual exposure down to a millisecond, strobe sync and deterministic latency. Run candidate screening on the stream and put a machine-vision smart camera on the ROIs that must confirm alarms.
Can one camera watch several flanges at once?
Yes, within the pixel budget. At 0.5 mm/px each 250 mm ROI is a 500 × 500 px window, and a 6 MP sensor fits more than twenty of them by area alone. Keep the same millimetre-per-pixel scale in every ROI, or recompute the gate in px² per minute for each scale; the percentage floor stays 2 %/min either way.



