Added filter parameters to readme.

This commit is contained in:
Rostislav Lán
2023-04-14 09:11:19 +02:00
parent b12a0d3e9b
commit a0ffab3593
3 changed files with 64 additions and 52 deletions

View File

@ -8,9 +8,10 @@ import cv2 as cv
from skimage import filters as skiflt
from skimage import restoration as skirest
from skimage import morphology as skimorph
# from scipy import signal as sig
from scipy import ndimage
from PIL import Image, ImageFilter
import bm3d
import matplotlib.pyplot as plt
class filter:
@ -133,7 +134,7 @@ class nlmeans(filter):
# Size of patches used for denoising
patch_size = int(params["patch_size"]) if params["patch_size"] else 5
# Distance in pixels where to search patches
# Distance in pixels where to search for patches
patch_distance = int(params["patch_distance"]
) if params["patch_distance"] else 3
@ -210,7 +211,7 @@ class unsharp_mask_scikit(filter):
str(radius) + " amount: " + str(amount))
self.img = skiflt.unsharp_mask(self.img, radius=radius,
amount=amount, channel_axis=None)
self.img = np.uint8(self.img * 255.0) # converting back to uintknapsack
self.img = np.uint8(self.img * 255.0) # converting back to uint
# ------------------- EDGE DETECTION FILTERS -------------------#
@ -319,6 +320,16 @@ class binarize(filter):
self.img = cv.threshold(self.img, threshold, maxval, type)[1]
class binarize_otsu(filter):
''' Otsu binarization filter from opencv.
'''
def init(self, img):
super().__init__(img)
def apply(self, _):
self.img = cv.threshold(self.img, 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)[1]
class add_margin(filter):
def init(self, img):
super().__init__(img)

View File

@ -122,7 +122,7 @@ class app:
# TODO: possibly too bloated, sending all possible params to each filter
# TODO: remove unnecessary params
possible_params = {"h", "searchWindowSize", "templateWindowSize",
"ksize", "kernel",
"ksize", "kernel", "angle",
"sigmaColor", "sigmaSpace", "diameter", "anchor", "iterations",
"op", "strength", "amount", "radius", "weight", "channelAxis",
"theta", "sigma", "lambd", "gamma", "psi", "shape", "percent",
@ -610,8 +610,7 @@ class app:
'''Map fingerprint to finger model.
'''
# TODO: this might be done in a better way
# instead of summing up the values, use their product - 0 ?
# TODO: this might be done in a better way, comment
z = np.array([])
for x in range(self.width):
z = np.append(z, np.sqrt(1 - (2*x/self.width - 1)**2)