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