Detect which image is sharper

As e.g. shown in this Matlab Central page, the sharpness can be estimated by the average gradient magnitude. I used this in Python as from PIL import Image import numpy as np im = Image.open(filename).convert(‘L’) # to grayscale array = np.asarray(im, dtype=np.int32) gy, gx = np.gradient(array) gnorm = np.sqrt(gx**2 + gy**2) sharpness = np.average(gnorm) A … Read more

Grid search for hyperparameter evaluation of clustering in scikit-learn

The clusteval library will help you to evaluate the data and find the optimal number of clusters. This library contains five methods that can be used to evaluate clusterings: silhouette, dbindex, derivative, dbscan and hdbscan. pip install clusteval Depending on your data, the evaluation method can be chosen. # Import library from clusteval import clusteval … Read more