Added filter parameters to readme.

master
Rostislav Lán 2 years ago
parent b12a0d3e9b
commit a0ffab3593

@ -76,20 +76,7 @@ Once all the requirements are installed, the program is ready to use. There are
There is an option to input the filter series as a preset from json configuration file. There is an option to input the filter series as a preset from json configuration file.
<table style="width:100%;">
<style>
table {
width: 100%;
}
th, td {
padding: 10px;
font-family: monospace;
width: 50%;
vertical-align: top;
}
</style>
<table>
<thead> <thead>
<tr> <tr>
<th>General format</th> <th>General format</th>
@ -147,49 +134,64 @@ All the filters used and their parameters are described below.
## Available filters with parameters ## Available filters with parameters
-median blur -median blur
-ksize - kernel size (int) -ksize - Kernel size (int)
-gaussian blur -gaussian blur
-ksize - Gaussian kernel size (int) -sigma - Gaussian kernel standart deviation (int)
-sigmaX - Kernel deviation in X direction (float)
-sigmaY - Kernel deviation in Y direction (float)
-bilateral blur -bilateral blur
-d - ? (int) -diameter - Diameter of pixel neighborhood used for filtering (int)
-sigmaColor - ? (int) -sigmaColor - Standard deviation for grayvalue/color distance (int)
-sigmaSpace - ? (int) -sigmaSpace - Standard deviation for range distance in pixels (int)
-denoise -bilateral_scikit
-h - ? (int) -sigmaColor - Standard deviation for grayvalue/color distance (float)
-tWS - template window size (int) -sigmaSpace - Standard deviation for range distance in pixels (float)
-sWs - search window size (int)
-denoise_bilateral -nlmeans (non-local means)
-sigmaColor - ? (int) -patch_size - Size of patches used for denoising (int)
-sigmaSpace - ? (int) -patch_distance - Distance in pixels where to search for patches (int)
-iterations - ? (int) -h - Cut-off distance, higher means more smoothed image (float)
-denoise_tv_chambolle -total_variation
-weight - ? (float) -weight - Denoising weight. (float)
-iterations - ? (int)
-sharpen -block_match
-kernel - ? (numpy.matrix) -sigma - ? (?)
-unsharp mask
-strength - ? (float)
-ksize - kernel size (int)
-unsharp mask scikit -unsharp mask scikit
-radius - ? (int) -radius - Radius of the gaussian filter (int)
-amount - ? (float) -amount - Strength of the unsharp mask (float)
-morph -farid
-kernel - ? (numpy.matrix)
-iterations - ? (int) -meijering
-op - opencv MORPH operation (MORPH_OPEN, MORPH_CLOSE,
MORPH_DILATE, MORPH_ERODE) -sato
-anchor - ? (tuple)
-hessian
-sigmas - ? (float)
-invert
-scale_values
-binarize
-threshold - value to cut differentiate pixels (int)
-maxval - maximal value (int) ??
-type - ? (str)
-binarize_otsu
-add_margin
-margin - number of pixels to add to the sides of the image (int)
-color - color value of newly added pixels (int)
-erode
-kernel - kernel shape (numpy.matrix)
-dilate
-kernel - kernel shape (numpy.matrix)
# Comparison # Comparison

@ -8,9 +8,10 @@ import cv2 as cv
from skimage import filters as skiflt from skimage import filters as skiflt
from skimage import restoration as skirest from skimage import restoration as skirest
from skimage import morphology as skimorph from skimage import morphology as skimorph
# from scipy import signal as sig from scipy import ndimage
from PIL import Image, ImageFilter from PIL import Image, ImageFilter
import bm3d import bm3d
import matplotlib.pyplot as plt
class filter: class filter:
@ -133,7 +134,7 @@ class nlmeans(filter):
# Size of patches used for denoising # Size of patches used for denoising
patch_size = int(params["patch_size"]) if params["patch_size"] else 5 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"] patch_distance = int(params["patch_distance"]
) if params["patch_distance"] else 3 ) if params["patch_distance"] else 3
@ -210,7 +211,7 @@ class unsharp_mask_scikit(filter):
str(radius) + " amount: " + str(amount)) str(radius) + " amount: " + str(amount))
self.img = skiflt.unsharp_mask(self.img, radius=radius, self.img = skiflt.unsharp_mask(self.img, radius=radius,
amount=amount, channel_axis=None) 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 -------------------# # ------------------- EDGE DETECTION FILTERS -------------------#
@ -319,6 +320,16 @@ class binarize(filter):
self.img = cv.threshold(self.img, threshold, maxval, type)[1] 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): class add_margin(filter):
def init(self, img): def init(self, img):
super().__init__(img) super().__init__(img)

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

Loading…
Cancel
Save