def extract_blur(self, plot=False):
"""
Calculate the variance of the 2nd derivative of the image to get blur.
Input: plot (bool) whether or not to show the image after Laplacian
Output: None"""
# do on grayscale
# check what the mean would give instead of variance
self.bluriness = filters.laplace(color.rgb2gray(self.image)).var()
if plot is True:
sns.set_style("whitegrid", {'axes.grid': False})
self.lap = filters.laplace(color.rgb2gray(self.image))
plt.imshow(self.lap)
plt.title('Laplacian of {}'.format(self.short_name))
plt.show()
plt.imshow(self.lap)
plt.show()
评论列表
文章目录