Files
observer/flutter_app/lib/detection/detection_result.dart
T

57 lines
1.3 KiB
Dart

class DetectionResult {
final String label;
final double score;
final double left;
final double top;
final double right;
final double bottom;
/// 轨迹已确认(多帧稳定/高分/活动确认),false = 候选,渲染为虚线
final bool confirmed;
const DetectionResult({
required this.label,
required this.score,
required this.left,
required this.top,
required this.right,
required this.bottom,
this.confirmed = true,
});
double get width => right - left;
double get height => bottom - top;
double get centerX => (left + right) / 2;
double get centerY => (top + bottom) / 2;
DetectionResult copyWith({
double? score,
double? left,
double? top,
double? right,
double? bottom,
bool? confirmed,
}) =>
DetectionResult(
label: label,
score: score ?? this.score,
left: left ?? this.left,
top: top ?? this.top,
right: right ?? this.right,
bottom: bottom ?? this.bottom,
confirmed: confirmed ?? this.confirmed,
);
}
class MotionRegion {
final double left;
final double top;
final double right;
final double bottom;
const MotionRegion(this.left, this.top, this.right, this.bottom);
double get centerX => (left + right) / 2;
double get centerY => (top + bottom) / 2;
}