Optimize live LED spline camera settings

This commit is contained in:
Meta Vens 2026-05-31 02:37:19 +01:00
commit 54b549a626
9 changed files with 522 additions and 4 deletions

View file

@ -404,6 +404,16 @@ a named invariant that the native runtime cannot protect yet.
solves the per-sensor curve, and emits the same spline quality report.
`--led-spline-frame-analysis-smoke` proves clipped blobs can still be
detected while scoring as unusable calibration evidence.
`Mimir.BufferSmoke --led-spline-live-score` now runs that score against live
direct sensor feeds. For KS/UVC cameras it sweeps manual exposure/gain,
drains stale frames after each write, scores the live luma frames for spline
quality, and prints a best setting per source. Current Starfire proof with
`--expected-leds 38 --minimum-luma 0.55` selected exposure `-9`, gain `8`
for both `kiyo-pro-rgb` (score `0.666`, 41 detections) and
`kiyo-basic-rgb` (score `0.650`, 38 detections). LeapUVC rejected the
generic KS exposure/gain writes and only recovered two LED components; both
PS3 Eye feeds currently score fixed-control frames because their native
wrapper does not yet expose gain/exposure.
Phase 6 program-output receipts are also structurally complete: Fensalir
publishes the final program surface through named shared D3D12 texture/fence
resources, the OBS plugin consumes that surface with an explicit D3D12-to-

View file

@ -36,6 +36,10 @@ flowchart TD
- Exposure/gain sweeps optimize recovered spline quality: detected LED count,
curve coverage, spacing coherence, smoothness, exposure fitness, and
saturation penalty. Bright clipped blobs are not good evidence.
- The live LED sweep owner is `Mimir.BufferSmoke --led-spline-live-score` for
now: it opens direct sensor feeds, applies KS/UVC manual exposure/gain where
supported, scores actual luma frames, and reports the best setting per
source. PS3 Eye and Leap-specific controls still need native control cuts.
- The first camera-rig solver fits bounded camera translation updates from a
scene-anchored LED curve by minimizing ray-to-curve distance. Rotation,
intrinsics, and distortion are future owners.

View file

@ -208,6 +208,28 @@ bool getPinProperty(HANDLE filter, ULONG pinId, ULONG propertyId, T& value)
return ksProperty(filter, &property, sizeof(property), &value, sizeof(value), &returned);
}
bool setVideoProcAmp(HANDLE filter, ULONG id, LONG value, ULONG flags)
{
KSPROPERTY_VIDEOPROCAMP_S property{};
property.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
property.Property.Id = id;
property.Property.Flags = KSPROPERTY_TYPE_SET;
property.Value = value;
property.Flags = flags;
return ksProperty(filter, &property, sizeof(property), &property, sizeof(property));
}
bool setCameraControl(HANDLE filter, ULONG id, LONG value, ULONG flags)
{
KSPROPERTY_CAMERACONTROL_S property{};
property.Property.Set = PROPSETID_VIDCAP_CAMERACONTROL;
property.Property.Id = id;
property.Property.Flags = KSPROPERTY_TYPE_SET;
property.Value = value;
property.Flags = flags;
return ksProperty(filter, &property, sizeof(property), &property, sizeof(property));
}
std::vector<std::string> enumerateCapturePaths()
{
std::vector<std::string> paths;
@ -617,6 +639,41 @@ __declspec(dllexport) int mimir_ks_start(MimirKsCameraCapture* capture)
return 1;
}
__declspec(dllexport) int mimir_ks_set_exposure_gain(
MimirKsCameraCapture* capture,
int setExposure,
LONG exposure,
int setGain,
LONG gain)
{
if (!capture || !capture->filter)
{
return 0;
}
int result = 0;
if (!setExposure ||
setCameraControl(
capture->filter.value,
KSPROPERTY_CAMERACONTROL_EXPOSURE,
exposure,
KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL))
{
result |= 1;
}
if (!setGain ||
setVideoProcAmp(
capture->filter.value,
KSPROPERTY_VIDEOPROCAMP_GAIN,
gain,
KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL))
{
result |= 2;
}
return result;
}
__declspec(dllexport) int mimir_ks_read(
MimirKsCameraCapture* capture,
int* width,

View file

@ -627,9 +627,17 @@ spacing coherence, smoothness, exposure fitness, and saturation penalty, and
`MimirLedSplineFrameAnalyzer` connects physical frames to that score by
extracting bright luma components, solving the sensor-local curve, and rejecting
clipped blobs as unusable calibration evidence even when they are easy to
detect. Once the frustum fit is coherent, detected surface candidates can be
sampled across every synchronized view before Fensalir resolves them into 4D
Gaussian/surface splat claims.
detect. `Mimir.BufferSmoke --led-spline-live-score` is the current live sweep
surface: KS/UVC cameras get manual exposure/gain writes before each scoring
window, stale frames are drained, luma is extracted from the actual live frame
format, and the best spline setting is reported per source. On 2026-05-31 with
`--expected-leds 38 --minimum-luma 0.55`, both Kiyo cameras selected exposure
`-9`, gain `8` (`kiyo-pro-rgb` score `0.666`; `kiyo-basic-rgb` score `0.650`).
LeapUVC rejected generic KS exposure/gain writes and only found two LED
components; PS3 Eye feeds are still fixed-control until the WinUSB wrapper owns
gain/exposure. Once the frustum fit is coherent, detected surface candidates
can be sampled across every synchronized view before Fensalir resolves them
into 4D Gaussian/surface splat claims.
The current teardown/migration map is
`docs/fensalir-rendering-rebuild-migration.md`, paired with Fensalir's

View file

@ -155,6 +155,11 @@ if (args.Any(arg => string.Equals(arg, "--led-spline-frame-analysis-smoke", Stri
return RunLedSplineFrameAnalysisSmoke();
}
if (args.Any(arg => string.Equals(arg, "--led-spline-live-score", StringComparison.OrdinalIgnoreCase)))
{
return RunLedSplineLiveScore(args);
}
if (args.Any(arg => string.Equals(arg, "--fensalir-texture-lease-smoke", StringComparison.OrdinalIgnoreCase)))
{
return RunFensalirTextureLeaseSmoke();
@ -1020,6 +1025,340 @@ static int RunLedSplineFrameAnalysisSmoke()
: 1;
}
static int RunLedSplineLiveScore(string[] args)
{
var ksLibrary = ParseStringOption(args, "--ks-native-library", Path.GetFullPath("native/camera_capture/build/Release/mimir_camera_capture.dll"));
var ps3Library = ParseStringOption(args, "--ps3eye-native-library", Path.GetFullPath("native/camera_capture/build/Release/mimir_ps3eye_capture.dll"));
var seconds = Math.Max(0.10, ParseDoubleOption(args, "--seconds", 1.0));
var settingSeconds = Math.Max(0.10, ParseDoubleOption(args, "--setting-seconds", 0.30));
var settleMs = Math.Max(0, ParseIntOption(args, "--settle-ms", 100));
var sweepControls = !args.Any(arg => string.Equals(arg, "--no-sweep", StringComparison.OrdinalIgnoreCase));
var expectedLedCount = Math.Max(1, ParseIntOption(args, "--expected-leds", 5));
var minimumLuma = Math.Clamp(ParseDoubleOption(args, "--minimum-luma", 0.70), 0.0, 1.0);
var sourceFilter = ParseStringOption(args, "--source-id", "");
var timeout = TimeSpan.FromSeconds(seconds);
var profiles = LiveLedSplineSensorProfiles(ksLibrary, ps3Library)
.Where(profile => string.IsNullOrWhiteSpace(sourceFilter) ||
string.Equals(profile.SourceId, sourceFilter, StringComparison.OrdinalIgnoreCase))
.ToArray();
if (profiles.Length == 0)
{
Console.WriteLine($"led-spline-live-score no-profile source={sourceFilter}");
return 1;
}
var anyCaptured = false;
foreach (var profile in profiles)
{
try
{
using var driver = CreateLiveLedSplineDriver(profile);
var settings = profile.Kind == LiveLedSplineSensorKind.Ks && sweepControls
? LiveLedSplineExposureGainSettings()
: [new LiveLedSplineExposureGainSetting("current", null, null)];
var results = new List<(LiveLedSplineExposureGainSetting Setting, bool Applied, LiveLedSplineScoreResult Result)>(settings.Count);
foreach (var setting in settings)
{
var applied = true;
if (driver is MimirKsVideoCaptureDriver ksDriver && (setting.Exposure.HasValue || setting.Gain.HasValue))
{
applied = ksDriver.TrySetExposureGain(setting.Exposure, setting.Gain);
Thread.Sleep(settleMs);
DrainLiveLedSplineFrames(driver);
}
var result = ScoreLiveLedSplineFeed(
driver,
profile,
settings.Count == 1 ? timeout : TimeSpan.FromSeconds(settingSeconds),
expectedLedCount,
minimumLuma);
anyCaptured |= result.FramesScored > 0;
results.Add((setting, applied, result));
Console.WriteLine(
$"led-spline-live-score source={profile.SourceId} setting={setting.Id} applied={applied} frames={result.FramesScored} bestScore={result.BestQuality?.Score ?? 0.0:0.000} bestDetected={result.BestQuality?.DetectedLedCount ?? 0} bestUsable={result.BestQuality?.UsableForCalibration ?? false} meanScore={result.MeanScore:0.000} meanDetected={result.MeanDetected:0.000} bestCoverage={result.BestQuality?.CurveCoverage ?? 0.0:0.000} bestSpacing={result.BestQuality?.SpacingCoherence ?? 0.0:0.000} bestSmooth={result.BestQuality?.Smoothness ?? 0.0:0.000} bestExposure={result.BestQuality?.ExposureFitness ?? 0.0:0.000} bestSaturated={result.BestQuality?.SaturatedFraction ?? 0.0:0.000} threshold={minimumLuma:0.000} format={result.LastPixelFormat} size={result.LastWidth}x{result.LastHeight}");
}
var best = results
.OrderByDescending(static item => item.Result.BestQuality?.Score ?? 0.0)
.ThenByDescending(static item => item.Result.BestQuality?.DetectedLedCount ?? 0)
.FirstOrDefault();
Console.WriteLine(
$"led-spline-live-best source={profile.SourceId} setting={best.Setting?.Id ?? "none"} exposure={best.Setting?.Exposure?.ToString(CultureInfo.InvariantCulture) ?? "current"} gain={best.Setting?.Gain?.ToString(CultureInfo.InvariantCulture) ?? "current"} score={best.Result?.BestQuality?.Score ?? 0.0:0.000} detected={best.Result?.BestQuality?.DetectedLedCount ?? 0} usable={best.Result?.BestQuality?.UsableForCalibration ?? false} control={(profile.Kind == LiveLedSplineSensorKind.Ks ? "ks-exposure-gain" : "fixed-control")}");
}
catch (Exception ex)
{
Console.WriteLine($"led-spline-live-score source={profile.SourceId} status=failed error=\"{ex.Message.Replace("\"", "'", StringComparison.Ordinal)}\"");
}
}
return anyCaptured ? 0 : 1;
}
static IReadOnlyList<LiveLedSplineExposureGainSetting> LiveLedSplineExposureGainSettings() =>
[
new("exp-10_gain-0", -10, 0),
new("exp-10_gain-8", -10, 8),
new("exp-9_gain-0", -9, 0),
new("exp-9_gain-8", -9, 8),
new("exp-8_gain-0", -8, 0),
new("exp-8_gain-8", -8, 8),
new("exp-7_gain-0", -7, 0),
new("exp-7_gain-8", -7, 8),
new("exp-6_gain-0", -6, 0),
new("exp-6_gain-8", -6, 8),
];
static void DrainLiveLedSplineFrames(IMimirVideoCaptureDriver driver)
{
for (var index = 0; index < 64; index++)
{
if (!driver.TryCapture(out _, out _))
{
return;
}
}
}
static IReadOnlyList<LiveLedSplineSensorProfile> LiveLedSplineSensorProfiles(string ksLibrary, string ps3Library) =>
[
LiveLedSplineSensorProfile.Ks(
"leap-stereo-ir",
ksLibrary,
"vid_f182&pid_0003&mi_00",
640,
240,
"YUY2",
100.0,
MimirVideoPixelFormat.LeapStereoIr),
LiveLedSplineSensorProfile.Ks(
"kiyo-pro-rgb",
ksLibrary,
"vid_1532&pid_0e05&mi_00",
640,
480,
"YUY2",
25.0,
MimirVideoPixelFormat.Yuy2),
LiveLedSplineSensorProfile.Ks(
"kiyo-basic-rgb",
ksLibrary,
"vid_1532&pid_0e03&mi_00",
640,
480,
"YUY2",
30.0,
MimirVideoPixelFormat.Yuy2),
LiveLedSplineSensorProfile.Ps3Eye(
"ps3-eye-0",
ps3Library,
0,
320,
240,
187),
LiveLedSplineSensorProfile.Ps3Eye(
"ps3-eye-1",
ps3Library,
1,
320,
240,
187),
];
static IMimirVideoCaptureDriver CreateLiveLedSplineDriver(LiveLedSplineSensorProfile profile)
{
if (profile.Kind == LiveLedSplineSensorKind.Ks)
{
return new MimirKsVideoCaptureDriver(new MimirKsVideoCaptureDriverOptions(
profile.NativeLibraryPath,
profile.SourceId,
profile.PathNeedle,
profile.Width,
profile.Height,
profile.FourCc,
profile.MinimumFramesPerSecond,
QueueDepth: 8,
profile.DeclaredPixelFormat));
}
return new MimirPs3EyeVideoCaptureDriver(new MimirPs3EyeVideoCaptureDriverOptions(
profile.NativeLibraryPath,
profile.SourceId,
profile.CameraIndex,
profile.Width,
profile.Height,
(int)Math.Round(profile.MinimumFramesPerSecond)));
}
static LiveLedSplineScoreResult ScoreLiveLedSplineFeed(
IMimirVideoCaptureDriver driver,
LiveLedSplineSensorProfile profile,
TimeSpan duration,
int expectedLedCount,
double minimumLuma)
{
var analyzer = new MimirLedSplineFrameAnalyzer(new MimirLedSplineFrameAnalyzerOptions(
expectedLedCount,
minimumLuma,
MinimumComponentPixels: 2,
MaximumComponentPixels: 8192));
var deadline = Stopwatch.GetTimestamp() + (long)(duration.TotalSeconds * Stopwatch.Frequency);
var framesScored = 0;
var scoreSum = 0.0;
var detectedSum = 0.0;
MimirLedSplineQualityReport? best = null;
var lastWidth = 0;
var lastHeight = 0;
var lastFormat = MimirVideoPixelFormat.Unknown;
while (Stopwatch.GetTimestamp() < deadline)
{
if (!driver.TryCapture(out var frame, out var data))
{
Thread.Sleep(1);
continue;
}
if (data.IsEmpty || !TryExtractLiveLuma(frame, data.Span, out var luma, out var lumaWidth, out var lumaHeight))
{
continue;
}
var analysis = analyzer.AnalyzeLumaFrame(
profile.SourceId,
$"{profile.SourceId}:live:{frame.ProducerFenceValue}",
lumaWidth,
lumaHeight,
luma,
frame.DeviceTimestampNs);
framesScored++;
scoreSum += analysis.Quality.Score;
detectedSum += analysis.Quality.DetectedLedCount;
lastWidth = lumaWidth;
lastHeight = lumaHeight;
lastFormat = frame.PixelFormat;
if (best == null ||
analysis.Quality.Score > best.Score ||
(Math.Abs(analysis.Quality.Score - best.Score) <= 1.0e-9 &&
analysis.Quality.DetectedLedCount > best.DetectedLedCount))
{
best = analysis.Quality;
}
}
return new LiveLedSplineScoreResult(
framesScored,
framesScored == 0 ? 0.0 : scoreSum / framesScored,
framesScored == 0 ? 0.0 : detectedSum / framesScored,
best,
lastWidth,
lastHeight,
lastFormat);
}
static bool TryExtractLiveLuma(
MimirVideoFrameDescriptor frame,
ReadOnlySpan<byte> data,
out byte[] luma,
out int lumaWidth,
out int lumaHeight)
{
lumaWidth = frame.Width;
lumaHeight = frame.Height;
if (lumaWidth <= 0 || lumaHeight <= 0)
{
luma = [];
return false;
}
luma = new byte[checked(lumaWidth * lumaHeight)];
var stride = frame.StrideBytes <= 0 ? DefaultStride(frame) : frame.StrideBytes;
switch (frame.PixelFormat)
{
case MimirVideoPixelFormat.Gray8:
case MimirVideoPixelFormat.R8:
case MimirVideoPixelFormat.Bayer8:
for (var y = 0; y < lumaHeight; y++)
{
var source = y * stride;
if (source + lumaWidth > data.Length)
{
return false;
}
data.Slice(source, lumaWidth).CopyTo(luma.AsSpan(y * lumaWidth, lumaWidth));
}
return true;
case MimirVideoPixelFormat.Yuy2:
case MimirVideoPixelFormat.LeapStereoIr:
for (var y = 0; y < lumaHeight; y++)
{
var row = y * stride;
if (row + lumaWidth * 2 > data.Length)
{
return false;
}
for (var x = 0; x < lumaWidth; x++)
{
luma[y * lumaWidth + x] = data[row + x * 2];
}
}
return true;
case MimirVideoPixelFormat.Rg8:
for (var y = 0; y < lumaHeight; y++)
{
var row = y * stride;
if (row + lumaWidth * 2 > data.Length)
{
return false;
}
for (var x = 0; x < lumaWidth; x++)
{
var offset = row + x * 2;
luma[y * lumaWidth + x] = (byte)((data[offset] + data[offset + 1]) / 2);
}
}
return true;
case MimirVideoPixelFormat.Bgra8:
for (var y = 0; y < lumaHeight; y++)
{
var row = y * stride;
if (row + lumaWidth * 4 > data.Length)
{
return false;
}
for (var x = 0; x < lumaWidth; x++)
{
var offset = row + x * 4;
luma[y * lumaWidth + x] = (byte)Math.Clamp(
(int)Math.Round(data[offset] * 0.114 + data[offset + 1] * 0.587 + data[offset + 2] * 0.299),
0,
255);
}
}
return true;
default:
luma = [];
return false;
}
}
static int DefaultStride(MimirVideoFrameDescriptor frame) =>
frame.PixelFormat switch
{
MimirVideoPixelFormat.Yuy2 or MimirVideoPixelFormat.LeapStereoIr or MimirVideoPixelFormat.Rg8 => frame.Width * 2,
MimirVideoPixelFormat.Bgra8 => frame.Width * 4,
_ => frame.Width,
};
static IReadOnlyList<MimirLedPixelDetection> ProjectLedDetections(
IReadOnlyList<MimirLedSplineScenePoint> scenePoints,
MimirCameraPoseEstimate pose,
@ -7357,6 +7696,79 @@ public sealed record ComplexContourChannelModelEvaluationCase(
double DeltaMeanAbsoluteErrorSamples,
double DeltaMeanAbsolutePhaseErrorRadians);
enum LiveLedSplineSensorKind
{
Ks,
Ps3Eye,
}
sealed record LiveLedSplineSensorProfile(
LiveLedSplineSensorKind Kind,
string SourceId,
string NativeLibraryPath,
string PathNeedle,
int CameraIndex,
int Width,
int Height,
string FourCc,
double MinimumFramesPerSecond,
MimirVideoPixelFormat DeclaredPixelFormat)
{
public static LiveLedSplineSensorProfile Ks(
string sourceId,
string nativeLibraryPath,
string pathNeedle,
int width,
int height,
string fourCc,
double minimumFramesPerSecond,
MimirVideoPixelFormat declaredPixelFormat) =>
new(
LiveLedSplineSensorKind.Ks,
sourceId,
nativeLibraryPath,
pathNeedle,
CameraIndex: -1,
width,
height,
fourCc,
minimumFramesPerSecond,
declaredPixelFormat);
public static LiveLedSplineSensorProfile Ps3Eye(
string sourceId,
string nativeLibraryPath,
int cameraIndex,
int width,
int height,
int framesPerSecond) =>
new(
LiveLedSplineSensorKind.Ps3Eye,
sourceId,
nativeLibraryPath,
PathNeedle: "",
cameraIndex,
width,
height,
FourCc: "BA81",
framesPerSecond,
MimirVideoPixelFormat.Bayer8);
}
sealed record LiveLedSplineScoreResult(
int FramesScored,
double MeanScore,
double MeanDetected,
MimirLedSplineQualityReport? BestQuality,
int LastWidth,
int LastHeight,
MimirVideoPixelFormat LastPixelFormat);
sealed record LiveLedSplineExposureGainSetting(
string Id,
int? Exposure,
int? Gain);
sealed class FakeFieldResourceBroker : IAquariumFieldResourceBroker
{
public string CommittedResourceKey { get; private set; } = "";

View file

@ -70,6 +70,18 @@ public sealed unsafe class MimirKsVideoCaptureDriver : IMimirVideoCaptureDriver,
public string DriverName => "ks-uvc-direct";
public bool TrySetExposureGain(int? exposure, int? gain)
{
var result = native.SetExposureGain(
capture,
exposure.HasValue ? 1 : 0,
exposure.GetValueOrDefault(),
gain.HasValue ? 1 : 0,
gain.GetValueOrDefault());
return (!exposure.HasValue || (result & 1) != 0) &&
(!gain.HasValue || (result & 2) != 0);
}
public void AttachTextureLeaseClient(MimirFensalirTextureLeaseClient? client)
{
textureLeaseClient = client;
@ -192,6 +204,7 @@ public sealed unsafe class MimirKsVideoCaptureDriver : IMimirVideoCaptureDriver,
private readonly nint library;
private readonly delegate* unmanaged[Stdcall]<byte*, int, int, byte*, double, int, nint> create;
private readonly delegate* unmanaged[Stdcall]<nint, int> start;
private readonly delegate* unmanaged[Stdcall]<nint, int, int, int, int, int> setExposureGain;
private readonly delegate* unmanaged[Stdcall]<nint, out int, out int, out int, byte*, int, out long, out ulong, byte*, int, int> read;
private readonly delegate* unmanaged[Stdcall]<nint, void> destroy;
@ -200,6 +213,7 @@ public sealed unsafe class MimirKsVideoCaptureDriver : IMimirVideoCaptureDriver,
this.library = library;
create = (delegate* unmanaged[Stdcall]<byte*, int, int, byte*, double, int, nint>)NativeLibrary.GetExport(library, "mimir_ks_create");
start = (delegate* unmanaged[Stdcall]<nint, int>)NativeLibrary.GetExport(library, "mimir_ks_start");
setExposureGain = (delegate* unmanaged[Stdcall]<nint, int, int, int, int, int>)NativeLibrary.GetExport(library, "mimir_ks_set_exposure_gain");
read = (delegate* unmanaged[Stdcall]<nint, out int, out int, out int, byte*, int, out long, out ulong, byte*, int, int>)NativeLibrary.GetExport(library, "mimir_ks_read");
destroy = (delegate* unmanaged[Stdcall]<nint, void>)NativeLibrary.GetExport(library, "mimir_ks_destroy");
}
@ -219,6 +233,9 @@ public sealed unsafe class MimirKsVideoCaptureDriver : IMimirVideoCaptureDriver,
public bool Start(nint capture) => start(capture) != 0;
public int SetExposureGain(nint capture, int setExposure, int exposure, int setGain, int gain) =>
setExposureGain(capture, setExposure, exposure, setGain, gain);
public int Read(
nint capture,
out int width,

View file

@ -252,7 +252,9 @@ public sealed class MimirLedSplineQualityScorer
UsableForCalibration: false);
}
var coverage = Clamp01(points.Length / (double)Math.Max(1, expectedLedCount));
var expected = Math.Max(1, expectedLedCount);
var detected = points.Length;
var coverage = Clamp01(Math.Min(detected / (double)expected, expected / (double)detected));
var spacing = SpacingCoherence(points);
var smoothness = Smoothness(points);
var pointConfidence = points.Average(static point => Clamp01(point.Confidence));

View file

@ -255,3 +255,4 @@
{"ts": "2026-05-31T02:05:12+01:00", "type": "implementation", "status": "ok", "note": "Added the first LED-strip calibration machine: MimirLedSplineCurveSolver orders bright detections into per-sensor image/clipspace curves, and MimirCameraRigCalibrationSolver consumes stable LED indices plus a scene-space LED curve anchor to emit bounded camera translation updates by minimizing ray-to-curve distance. Rotation, focal length, and distortion remain explicit future calibration owners."}
{"ts": "2026-05-31T02:12:01+01:00", "type": "decision", "status": "ok", "note": "LED exposure/gain sweeps must optimize recovered spline quality, not raw brightness/contrast. MimirLedSplineQualityScorer now scores detected LED count, curve coverage, spacing coherence, smoothness, exposure fitness, and saturation penalty; overexposed halos can see every LED and still lose because centroid/curve quality is bad."}
{"ts": "2026-05-31T02:16:04+01:00", "type": "implementation", "status": "ok", "note": "Added MimirLedSplineFrameAnalyzer as the frame-level bridge for physical camera sweeps: it extracts bright luma components, solves a per-sensor LED curve, and feeds MimirLedSplineQualityScorer so saturated blobs can be detected but rejected as poor calibration evidence."}
{"ts": "2026-05-31T03:05:00+01:00", "type": "verification", "status": "ok", "note": "Live LED spline sweep now runs on actual direct sensor feeds. `dotnet run --project src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj -- --led-spline-live-score --setting-seconds 0.25 --settle-ms 100 --expected-leds 38 --minimum-luma 0.55` selected exposure -9/gain 8 for `kiyo-pro-rgb` (score 0.666, 41 detections, usable) and `kiyo-basic-rgb` (score 0.650, 38 detections, usable). LeapUVC rejected generic KS exposure/gain writes and only recovered two LED components; both PS3 Eye feeds scored 0 at current fixed controls because their native wrapper does not yet expose gain/exposure."}

View file

@ -122,6 +122,13 @@ invariants:
usable for calibration. `MimirLedSplineFrameAnalyzer` now extracts bright
luma components from real frames into the same score path, so clipped blobs
can be detected while still rejected as bad spline evidence.
`Mimir.BufferSmoke --led-spline-live-score` now scores actual direct sensor
feeds. KS/UVC sources sweep manual exposure/gain before each live scoring
window and print a best setting per source; the 2026-05-31 live proof with
`--expected-leds 38 --minimum-luma 0.55` selected exposure `-9`, gain `8`
for both Kiyo Pro and Kiyo Basic. LeapUVC rejected the generic KS
exposure/gain writes and PS3 Eye capture remains fixed-control until its
native wrapper owns gain/exposure.
- Fensalir packet payload handles are not authority. Live payload references
must resolve through declared typed GPU/native resources with shape,
residency, shader access, validity, version, and handle metadata before