diff --git a/src/config_parser.py b/src/config_parser.py index b4f8bc9..f603cf2 100644 --- a/src/config_parser.py +++ b/src/config_parser.py @@ -113,7 +113,7 @@ def parse_params(params): "diameter", "sigmaColor", "sigmaSpace", "patch_size", "patch_distance", "weight", "amount", "radius", "percent", - "threshold", + "threshold", "h", "margin", "color" } diff --git a/src/filters.py b/src/filters.py index e9cf5a2..da3b9f7 100644 --- a/src/filters.py +++ b/src/filters.py @@ -181,7 +181,6 @@ class block_match(img_filter): self.img = np.uint8(self.img) - class unsharp_mask_scikit(img_filter): ''' Unsharp mask filter from scikit. @@ -232,8 +231,8 @@ class unsharp_mask_pil(img_filter): class farid(img_filter): - ''' Farid filter from filters. - Not sure what this might be used for yet. + ''' Farid filter from filters. + Finds edges of the image. ''' def __init__(self, img): @@ -242,7 +241,7 @@ class farid(img_filter): def apply(self, _): self.img = skiflt.farid(self.img) - self.img = np.uint8(self.img) + self.img = np.uint8(self.img*255) # ------------------ RIDGE EXTRACTION FILTERS ------------------# @@ -250,6 +249,7 @@ class farid(img_filter): class meijering(img_filter): ''' Meijering filter from scikit-image filters. + Finds continuous ridges. ''' def __init__(self, img): @@ -263,7 +263,7 @@ class meijering(img_filter): class sato(img_filter): ''' Meijering filter from scikit-image filters. - Exctracts black ridges. + Exctracts continuous ridges. ''' def __init__(self, img): @@ -304,7 +304,6 @@ class invert(img_filter): self.img = np.uint8(self.img) - class scale_values(img_filter): ''' Scale values of the image to use the entire range of data type. This should remove the line height issues. @@ -313,7 +312,7 @@ class scale_values(img_filter): def __init__(self, img): super().__init__(img) - def apply(self, params): + def apply(self, _): # scale once for inverted image and once for original # this is done to get the full value range of the data type # which might help getting exact line height on stl model @@ -323,10 +322,11 @@ class scale_values(img_filter): self.img = cv.bitwise_not(tmp.astype(np.uint8)) coef = 255 / np.max(tmp) tmp = tmp * coef - self.img = np.uint8(tmp) class binarize(img_filter): + ''' Binarization filter from opencv. + ''' def init(self, img): super().__init__(img) @@ -337,7 +337,6 @@ class binarize(img_filter): self.img = np.uint8(self.img) - class binarize_otsu(img_filter): ''' Otsu binarization filter from opencv. ''' @@ -349,7 +348,6 @@ class binarize_otsu(img_filter): self.img = np.uint8(self.img) - class add_margin(img_filter): def init(self, img): super().__init__(img) @@ -369,9 +367,7 @@ class add_margin(img_filter): # ---------------------- MORPHOLOGICAL OPS --------------------------# class erode(img_filter): - ''' General morphological operations from OpenCV. - - Can be used with MORPH_OPEN, MORPH_CLOSE, MORPH_DILATE, MORPH_ERODE and more as 'op'. + ''' Erosion morphological operation from OpenCV module. ''' def __init__(self, img): @@ -389,9 +385,7 @@ class erode(img_filter): class dilate(img_filter): - ''' General morphological operations from OpenCV. - - Can be used with MORPH_OPEN, MORPH_CLOSE, MORPH_DILATE, MORPH_ERODE and more as 'op'. + ''' Dilation morphological operation from OpenCV module. ''' def __init__(self, img):