feat: bulk blur, bulk grayscale

This commit is contained in:
Artemy Egorov 2023-04-26 19:04:08 +03:00
parent 7742416a53
commit 995481f437

View file

@ -5,9 +5,7 @@ import numpy as np
def edge(file_name):
image = Image.open(file_name)
image = image.convert("L")
return image.filter(ImageFilter.FIND_EDGES)
@ -19,6 +17,16 @@ def canny_edge(file_name):
return Image.fromarray(feature.canny(image, sigma=2))
def blur(file_name):
image = Image.open(file_name)
return image.filter(ImageFilter.BLUR)
def grayscale(file_name):
image = Image.open(file_name)
return image.convert("L")
def sharpen(file_name):
image = Image.open(file_name)
return image.filter(ImageFilter.SHARPEN)
@ -28,6 +36,8 @@ methods_funcs = {
"Sharpen": sharpen,
"Edge detection": edge,
"Canny edge detection": canny_edge,
"Grayscale": grayscale,
"Blur": blur,
}
methods = list(methods_funcs.keys())