Hi, I have used OpenCvSharp for the first time. I'm using it to find out if an image is blurred or not. Some of the images are blurred but my code is returning that the image is not blurred. Attached image for reference. Please review my code and let me know if I have used OpenCvSharp correctly.
Environment
Windows 10 Machine, Using C#
Example code:
public static bool IsBlurry(string imagePath, double threshold = 100.0)
{
// Load the image
var image = Cv2.ImRead(imagePath, ImreadModes.Grayscale);
// Compute the Laplacian of the image
var laplacian = new Mat();
Cv2.Laplacian(image, laplacian, MatType.CV_64F);
// Compute the variance of Laplacian
Cv2.MeanStdDev(laplacian, out _, out var stddev);
var varianceValue = stddev.Val0 * stddev.Val0; // Variance = standard deviation squared
// Check if the image is blurred
return varianceValue < threshold;
}
Summary of your issue
Hi, I have used OpenCvSharp for the first time. I'm using it to find out if an image is blurred or not. Some of the images are blurred but my code is returning that the image is not blurred. Attached image for reference. Please review my code and let me know if I have used OpenCvSharp correctly.
Environment
Windows 10 Machine, Using C#
Example code:
Output:
What did you intend to be?
Accurately detect if the image is blurred.
![photo-1485288734756-0b31a0a31d95](https://github.com/shimat/opencvsharp/assets/2034469/7e936770-7105-4e9f-ab3d-7d3ebbe26b78)