Simply, I am trying to calculate the sharpness of an image as a part of a function in C# using OpenCVSharp.
As the 1st try, I used Laplacian Filter like this:
int kernel_size = 3;
int scale = 1;
int delta = 0;
int ddepth = image.Type().Depth;
Mat sharpenedImage = image.Laplacian(ddepth, kernel_size, scale, delta);
\* calculate the variance of the laplacian*\
Finally, I want the variance of this sharpenedImage
.
I have tried that easily in Python:
def variance_of_laplacian(image):
lap_val = cv2.Laplacian(image, cv2.CV_8UC1)
return lap_val.var()
So is there any equivalent of lap_val.var()
in C#?
I couldn't find any matching article regarding this. Thank you!