evaluateImageQuality static method

Future<bool> evaluateImageQuality({
  1. required String imagePath,
  2. int acceptableBlurThreshold = 0,
})

Implementation

static Future<bool> evaluateImageQuality(
    {required String imagePath, int acceptableBlurThreshold = 0}) async {
  // Load the model if not already loaded
  await loadModel();

  bool isImageSharp = false;

  // Get the blur ratio from the model prediction
  isImageSharp = await _checkSharp(imagePath, acceptableBlurThreshold);

  if (isImageSharp) {
    // Check if the text is clear in the image
    bool isTextReadable = await TextDetector.checkTextReadability(imagePath);
    return isTextReadable;
  } else {
    return false;
  }
}