fix(visaged): warm up with the IR emitter active so the first verify is not blown out - #104
Open
jeffshee wants to merge 1 commit into
Open
fix(visaged): warm up with the IR emitter active so the first verify is not blown out#104jeffshee wants to merge 1 commit into
jeffshee wants to merge 1 commit into
Conversation
…is not blown out
Sensor auto-gain only adapts while streaming, drops in about two seconds
when a quirked emitter saturates it, and rises slowly afterwards. The
startup warmup streamed with the emitter off, so gain settled against
ambient light and the first capture after every daemon start — the first
sudo after boot or resume — was saturated white and failed detection.
Activate the emitter before the warmup and run it as one continuous
capture_frames stream. VISAGE_WARMUP_FRAMES now counts usable frames (the
strobe's unlit half is skipped) and is documented; 25 works well on the
camera below.
Measured A/B on Syntek 174f:11a8, same starting state (gain adapted to
ambient, emitter off), reproducing each path's exact capture sequence:
unfixed first verify: detector gets frame means [33, 255, 33]
(silhouette, white-out, silhouette); 3 s later [208, 206, 172]
fixed first verify: detector gets [24, 24, 24], face crisply lit
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Jeff Shee <jeffshee8969@gmail.com>
jeffshee
added a commit
to jeffshee/visage
that referenced
this pull request
Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
On a camera with an emitter quirk, the first verify after every daemon start fails. That is
the first
sudoafter boot, and after every resume, sincevisage-resume.servicerestartsthe daemon.
Cause: sensor auto-gain only adapts while streaming, drops in about two seconds when the
emitter saturates it, and rises slowly. The startup warmup streams with the emitter off,
so gain settles against ambient light; the first lit capture is then saturated white and the
detector sees nothing. The symptom is indistinguishable from a liveness failure in the logs
(
displacement=0.0, the single-usable-frame fail-closed case).Type
What this changes
spawn_engineactivates the emitter before the warmup and runs the warmup as one continuouscapture_framesstream instead of N single-framecapture_framecalls, then deactivates it.Gain settles against the emitter, and since nothing streams with the emitter off afterwards,
every later capture starts adapted.
VISAGE_WARMUP_FRAMESkeeps its default of 4 but now counts usable frames (capture_framesskips the strobe's unlit half). It was already read by the daemon and exposed by the NixOS
module; this adds its missing row to the operations guide's variable table.
Testing
A/B on Syntek
174f:11a8(ThinkPad P14s Gen 4, quirk in #102), same starting state for both(gain adapted to ambient, emitter off), reproducing each path's exact capture sequence and
recording the frames
capture_frames(3)would hand to the detector:[33, 255, 33]— silhouette, white-out, silhouette[208, 206, 172][24, 24, 24]— face crisply litRunning the daemon with this change on Fedora 44 (
VISAGE_WARMUP_FRAMES=25): ready 3.3 safter start, first verify after restart matches.
cargo test --workspacepasses.Checklist
cargo fmt --all -- --checkpassescargo clippy --workspace -- -D warningspassescargo test --workspacepassesgit commit -s) per the DCOBreaking changes
None. Cameras without a quirk behave as before (no emitter to activate). On quirked cameras
the warmup takes slightly longer for the same number, since unlit strobe frames no longer
count. Cameras with
reset_on_close = truehold an fd open for the warmup's duration, as theyalready do for each capture.