diff --git a/mobile/lib/services/machine_learning/face_ml/face_filtering/blur_detection_service.dart b/mobile/lib/services/machine_learning/face_ml/face_filtering/blur_detection_service.dart index 9c8d2d8c80..4e23d36556 100644 --- a/mobile/lib/services/machine_learning/face_ml/face_filtering/blur_detection_service.dart +++ b/mobile/lib/services/machine_learning/face_ml/face_filtering/blur_detection_service.dart @@ -3,14 +3,14 @@ import "package:photos/services/machine_learning/face_ml/face_detection/detectio import 'package:photos/services/machine_learning/face_ml/face_filtering/face_filtering_constants.dart'; class BlurDetectionService { - final _logger = Logger('BlurDetectionService'); + static final _logger = Logger('BlurDetectionService'); // singleton pattern BlurDetectionService._privateConstructor(); static final instance = BlurDetectionService._privateConstructor(); factory BlurDetectionService() => instance; - Future<(bool, double)> predictIsBlurGrayLaplacian( + static Future<(bool, double)> predictIsBlurGrayLaplacian( List> grayImage, { int threshold = kLaplacianHardThreshold, FaceDirection faceDirection = FaceDirection.straight, @@ -22,7 +22,7 @@ class BlurDetectionService { return (variance < threshold, variance); } - double _calculateVariance(List> matrix) { + static double _calculateVariance(List> matrix) { final int numRows = matrix.length; final int numCols = matrix[0].length; final int totalElements = numRows * numCols; @@ -49,7 +49,7 @@ class BlurDetectionService { return variance; } - List> _padImage( + static List> _padImage( List> image, { int removeSideColumns = 56, FaceDirection faceDirection = FaceDirection.straight, @@ -115,7 +115,7 @@ class BlurDetectionService { return paddedImage; } - List> _applyLaplacian( + static List> _applyLaplacian( List> image, { FaceDirection faceDirection = FaceDirection.straight, }) { diff --git a/mobile/lib/utils/image_ml_util.dart b/mobile/lib/utils/image_ml_util.dart index ef1af56383..dc22badd72 100644 --- a/mobile/lib/utils/image_ml_util.dart +++ b/mobile/lib/utils/image_ml_util.dart @@ -248,7 +248,7 @@ Future<(Float32List, List, List, List, Size)> final grayscalems = blurDetectionStopwatch.elapsedMilliseconds; log('creating grayscale matrix took $grayscalems ms'); final (isBlur, blurValue) = - await BlurDetectionService.instance.predictIsBlurGrayLaplacian( + await BlurDetectionService.predictIsBlurGrayLaplacian( faceGrayMatrix, faceDirection: face.getFaceDirection(), );