Validate exact Vision boundary values and real-project regression

This commit is contained in:
Mikei386 committed 2026-09-13 10:33:13 +02:00
1 parent e1457aede1
commit 031dc50b99
3 files changed
+38 -8

No files matched your search

+4 -3
View File
@@ -924,9 +924,10 @@ final class VideoProcessor: ObservableObject {
if let pose = sample.pose {
guard [pose.x, pose.y, pose.height, pose.yaw, pose.roll].allSatisfy({ $0.isFinite }),
(0...1).contains(pose.x), (0...1).contains(pose.y), (0...1).contains(pose.height),
// Vision angles originate as Float; Float.pi is slightly larger than Double.pi.
abs(pose.yaw) <= Double(Float.pi), abs(pose.roll) <= Double(Float.pi),
pose.pitch == nil || (pose.pitch!.isFinite && abs(pose.pitch!) <= Double(Float.pi)) else { return false }
// Vision may return either Float rounding adjacent to pi. Swift Float.pi
// is not necessarily the rounding used by Vision; allow 1e-6 radians.
abs(pose.yaw) <= (.pi + 1e-6), abs(pose.roll) <= (.pi + 1e-6),
pose.pitch == nil || (pose.pitch!.isFinite && abs(pose.pitch!) <= (.pi + 1e-6)) else { return false }
}
if let color = sample.color {
guard color.luminance.isFinite, (0...1).contains(color.luminance),