def apply_blur(self, image):
""" Adds a blur to the given image, using the kernel size
defined in settings. """
if ENABLE_DEBUG:
print("DEBUG -- Attempting to apply gaussian blur to"
" grayscale image.")
try:
blurred = cv2.GaussianBlur(src=image,
ksize=BLUR_KERNEL_SIZE,
sigmaX=0)
except:
if VERBOSE_EXIT:
print("ERROR -- Could not apply blur filter. Please check"
" settings and consider changing the blur kernel size.")
exit()
if ENABLE_PREVIEW_ALL:
image_preview(blurred)
if ENABLE_DEBUG:
print("DEBUG -- Gaussian Blur succesfully applied.")
return blurred
评论列表
文章目录