Moved test.sh to src, testing new filter.

master
Rostislav Lán 2 years ago
parent 4efee4d38c
commit fe8eda2310

@ -0,0 +1,23 @@
{
"test-very-strong": [
{
"name": "denoise_tv_chambolle",
"weight": 0.01,
"iterations": 1
},
{
"name": "median",
"ksize": 3
},
{
"name": "unsharp_mask_scikit",
"radius": 3,
"amount": 7,
"channelAxis": 0
},
{
"name": "gaussian",
"ksize": 7
}
]
}

Binary file not shown.

@ -301,6 +301,33 @@ class unsharp_mask_scikit(filter):
#self.img = cv.cvtColor(self.img, cv.COLOR_RGB2GRAY) #self.img = cv.cvtColor(self.img, cv.COLOR_RGB2GRAY)
class unsharp_mask_pil(filter):
''' Unsharp mask filter from PIL.
'''
# TODO: does not work
def __init__(self, img):
super().__init__(img)
def apply(self, params):
# Blur radius
radius = int(params["radius"]) if params["radius"] else 2
# Unsharp strength in percent
percent = int(params["percent"]) if params["percent"] else 150
# Threshold controls the minimum brightness change that will be sharpened
threshold = int(params["threshold"]) if params["threshold"] else 3
#print("with params: radius: " +
# str(radius) + " percent: " + str(percent) + " threshold: " + str(threshold))
self.img = np.uint8(self.img)
tmp = Image.fromarray(self.img)
tmp = tmp.filter(ImageFilter.UnsharpMask(radius, percent, threshold))
self.img = np.asarray(tmp)
class morph(filter): class morph(filter):
''' General morphological operations from OpenCV. ''' General morphological operations from OpenCV.

Loading…
Cancel
Save