diff --git a/config/config-test.json b/config/config-test.json new file mode 100644 index 0000000..41e1005 --- /dev/null +++ b/config/config-test.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/res/examples/Palec_P4.stl b/res/examples/Palec_P4.stl deleted file mode 100644 index f091536..0000000 Binary files a/res/examples/Palec_P4.stl and /dev/null differ diff --git a/src/filters.py b/src/filters.py index e1f8427..09320ff 100644 --- a/src/filters.py +++ b/src/filters.py @@ -301,6 +301,33 @@ class unsharp_mask_scikit(filter): #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): ''' General morphological operations from OpenCV. diff --git a/test.sh b/src/test.sh similarity index 100% rename from test.sh rename to src/test.sh