feat(analysis): add metadata light analyzer with findings

Cadence, jitter, gaps and sessions (small sessions merge), timestamp
sanity (duplicates, out-of-order frames, clock jumps incl. DST), EV
series and exposure steps, camera/lens identity, resolution and
orientation consistency, and NOAA day phases from GPS. Findings carry
stable resource keys plus positional arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 09:51:43 +00:00
1 parent 40870e12dc
commit 3b3d7b7f6b
4 files changed
+647

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
using Titano.Core.Metadata;
using Titano.Core.Model;
namespace Titano.Core.Analysis;
/// <summary>The metadata the light analysis needs from one frame (BRIEF §10.1).</summary>
public sealed record LightFrame
{
public int Index { get; init; }
/// <summary>Camera wall-clock capture time (unspecified kind).</summary>
public DateTime? CapturedAt { get; init; }
/// <summary>UTC offset of <see cref="CapturedAt"/> in minutes, when recorded.</summary>
public int? UtcOffsetMinutes { get; init; }
public double? ExposureTime { get; init; }
public double? FNumber { get; init; }
public int? Iso { get; init; }
public double? ExposureBias { get; init; }
public int Width { get; init; }
public int Height { get; init; }
public int Orientation { get; init; } = 1;
public string? CameraMake { get; init; }
public string? CameraModel { get; init; }
public string? CameraSerial { get; init; }
public string? Lens { get; init; }
public double? Latitude { get; init; }
public double? Longitude { get; init; }
/// <summary>GPS (satellite) UTC time stamp, used to infer the camera clock's UTC offset.</summary>
public DateTime? GpsUtc { get; init; }
/// <summary>Exposure value at ISO 100: log2(N²/t) − log2(ISO/100).</summary>
public double? ExposureValue => ExposureTime is > 0 && FNumber is > 0
? Math.Log2(FNumber.Value * FNumber.Value / ExposureTime.Value) - Math.Log2((Iso is > 0 ? Iso.Value : 100) / 100.0)
: null;
/// <summary>Width and height after Exif orientations 5–8 (90° rotations).</summary>
public (int Width, int Height) OrientedSize => Orientation is >= 5 and <= 8 ? (Height, Width) : (Width, Height);
public static LightFrame From(Frame frame)
{
ArgumentNullException.ThrowIfNull(frame);
return new LightFrame
{
Index = frame.Index,
CapturedAt = frame.CapturedAt,
UtcOffsetMinutes = frame.UtcOffsetMinutes,
ExposureTime = frame.ExposureTime,
FNumber = frame.FNumber,
Iso = frame.Iso,
ExposureBias = frame.ExposureBias,
Width = frame.Width,
Height = frame.Height,
Orientation = frame.Orientation,
};
}
public static LightFrame From(FrameMetadata metadata, int index)
{
ArgumentNullException.ThrowIfNull(metadata);
return new LightFrame
{
Index = index,
CapturedAt = metadata.CapturedAt,
UtcOffsetMinutes = metadata.UtcOffsetMinutes,
ExposureTime = metadata.ExposureTime,
FNumber = metadata.FNumber,
Iso = metadata.Iso,
ExposureBias = metadata.ExposureBias,
Width = metadata.Width,
Height = metadata.Height,
Orientation = metadata.Orientation,
CameraMake = metadata.Make,
CameraModel = metadata.Model,
CameraSerial = metadata.BodySerial,
Lens = metadata.LensModel,
Latitude = metadata.Gps?.Latitude,
Longitude = metadata.Gps?.Longitude,
GpsUtc = metadata.Gps?.UtcTimestamp,
};
}
}