correction du centrage des vecteurs de zone (cercle) pour le plotting
This commit is contained in:
@@ -53,6 +53,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
double _targetCenterX = 0.5;
|
||||
double _targetCenterY = 0.5;
|
||||
double _targetRadius = 0.4;
|
||||
double _targetInnerRadius = 0.04;
|
||||
int _ringCount = 10;
|
||||
List<double>? _ringRadii; // Individual ring radii multipliers
|
||||
double _imageAspectRatio = 1.0; // width / height
|
||||
@@ -83,6 +84,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
double get targetCenterX => _targetCenterX;
|
||||
double get targetCenterY => _targetCenterY;
|
||||
double get targetRadius => _targetRadius;
|
||||
double get targetInnerRadius => _targetInnerRadius;
|
||||
int get ringCount => _ringCount;
|
||||
List<double>? get ringRadii =>
|
||||
_ringRadii != null ? List.unmodifiable(_ringRadii!) : null;
|
||||
@@ -138,6 +140,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
_targetCenterX = 0.5;
|
||||
_targetCenterY = 0.5;
|
||||
_targetRadius = 0.4;
|
||||
_targetInnerRadius = 0.04;
|
||||
|
||||
// Initialize empty shots list
|
||||
_shots = [];
|
||||
@@ -160,6 +163,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
_targetCenterX = result.centerX;
|
||||
_targetCenterY = result.centerY;
|
||||
_targetRadius = result.radius;
|
||||
_targetInnerRadius = result.radius * 0.1;
|
||||
|
||||
// Create shots from detected impacts
|
||||
_shots = result.impacts.map((impact) {
|
||||
@@ -488,12 +492,14 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
void adjustTargetPosition(
|
||||
double centerX,
|
||||
double centerY,
|
||||
double innerRadius,
|
||||
double radius, {
|
||||
int? ringCount,
|
||||
List<double>? ringRadii,
|
||||
}) {
|
||||
_targetCenterX = centerX;
|
||||
_targetCenterY = centerY;
|
||||
_targetInnerRadius = innerRadius;
|
||||
_targetRadius = radius;
|
||||
if (ringCount != null) {
|
||||
_ringCount = ringCount;
|
||||
@@ -520,7 +526,12 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
final result = await _opencvTargetService.detectTarget(_imagePath!);
|
||||
|
||||
if (result.success) {
|
||||
adjustTargetPosition(result.centerX, result.centerY, result.radius);
|
||||
adjustTargetPosition(
|
||||
result.centerX,
|
||||
result.centerY,
|
||||
result.radius * 0.1,
|
||||
result.radius,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -687,6 +698,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
_targetCenterX = 0.5;
|
||||
_targetCenterY = 0.5;
|
||||
_targetRadius = 0.4;
|
||||
_targetInnerRadius = 0.04;
|
||||
_ringCount = 10;
|
||||
_ringRadii = null;
|
||||
_imageAspectRatio = 1.0;
|
||||
|
||||
Reference in New Issue
Block a user