You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
}
Output:
paste your output
What did you intend to be?
Accurately detect if the image is blurred.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: