feat: implement base architecture and core repositories for weapon tracking and target analysis functionality

This commit is contained in:
streaper2
2026-05-08 20:29:18 +02:00
parent 5dd58da51c
commit 774dbfcf40
37 changed files with 3687 additions and 2713 deletions

View File

@@ -8,6 +8,7 @@ library;
import 'dart:io';
import 'dart:math' as math;
import 'package:image/image.dart' as img;
import 'package:flutter/foundation.dart';
import 'package:opencv_dart/opencv_dart.dart' as cv;
import 'package:path_provider/path_provider.dart';
@@ -562,8 +563,9 @@ class DistortionCorrectionService {
double maxArea = 0;
for (final contour in contours) {
if (contour.length < 5)
if (contour.length < 5) {
continue; // fitEllipse nécessite au moins 5 points
}
final area = cv.contourArea(contour);
if (area < 1000) continue; // Ignorer les trop petits bruits
@@ -636,7 +638,7 @@ class DistortionCorrectionService {
return outputPath;
} catch (e) {
// En cas d'erreur, retourner l'image originale
print('Erreur correction perspective cercles: $e');
debugPrint('Erreur correction perspective cercles: $e');
return imagePath;
}
}
@@ -761,7 +763,7 @@ class DistortionCorrectionService {
return outputPath;
} catch (e) {
print('Erreur correction perspective ovales: $e');
debugPrint('Erreur correction perspective ovales: $e');
return imagePath;
}
}
@@ -822,7 +824,7 @@ class DistortionCorrectionService {
}
if (concentricGroup.length < 2) {
print(
debugPrint(
"Pas assez de cercles concentriques pour le maillage, utilisation de la méthode simple.",
);
return await correctPerspectiveUsingOvals(imagePath);
@@ -950,7 +952,7 @@ class DistortionCorrectionService {
return outputPath;
} catch (e) {
print('Erreur correction perspective maillage concentrique: $e');
debugPrint('Erreur correction perspective maillage concentrique: $e');
return imagePath;
}
}
@@ -1012,7 +1014,7 @@ class DistortionCorrectionService {
// Fallback
if (bestQuad == null) {
print(
debugPrint(
"Aucun papier quadrilatère détecté, on utilise les cercles à la place.",
);
return await correctPerspectiveUsingCircles(imagePath);
@@ -1060,7 +1062,7 @@ class DistortionCorrectionService {
return outputPath;
} catch (e) {
print('Erreur correction perspective quadrilatère: $e');
debugPrint('Erreur correction perspective quadrilatère: $e');
// Fallback
return await correctPerspectiveUsingCircles(imagePath);
}