Added filter parameters to readme.
This commit is contained in:
94
README.md
94
README.md
@ -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.
|
||||
|
||||
|
||||
<style>
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
th, td {
|
||||
padding: 10px;
|
||||
font-family: monospace;
|
||||
width: 50%;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>
|
||||
|
||||
<table>
|
||||
<table style="width:100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>General format</th>
|
||||
@ -147,49 +134,64 @@ All the filters used and their parameters are described below.
|
||||
## Available filters with parameters
|
||||
|
||||
-median blur
|
||||
-ksize - kernel size (int)
|
||||
-ksize - Kernel size (int)
|
||||
|
||||
-gaussian blur
|
||||
-ksize - Gaussian kernel size (int)
|
||||
-sigmaX - Kernel deviation in X direction (float)
|
||||
-sigmaY - Kernel deviation in Y direction (float)
|
||||
-sigma - Gaussian kernel standart deviation (int)
|
||||
|
||||
-bilateral blur
|
||||
-d - ? (int)
|
||||
-sigmaColor - ? (int)
|
||||
-sigmaSpace - ? (int)
|
||||
-diameter - Diameter of pixel neighborhood used for filtering (int)
|
||||
-sigmaColor - Standard deviation for grayvalue/color distance (int)
|
||||
-sigmaSpace - Standard deviation for range distance in pixels (int)
|
||||
|
||||
-denoise
|
||||
-h - ? (int)
|
||||
-tWS - template window size (int)
|
||||
-sWs - search window size (int)
|
||||
-bilateral_scikit
|
||||
-sigmaColor - Standard deviation for grayvalue/color distance (float)
|
||||
-sigmaSpace - Standard deviation for range distance in pixels (float)
|
||||
|
||||
-denoise_bilateral
|
||||
-sigmaColor - ? (int)
|
||||
-sigmaSpace - ? (int)
|
||||
-iterations - ? (int)
|
||||
-nlmeans (non-local means)
|
||||
-patch_size - Size of patches used for denoising (int)
|
||||
-patch_distance - Distance in pixels where to search for patches (int)
|
||||
-h - Cut-off distance, higher means more smoothed image (float)
|
||||
|
||||
-denoise_tv_chambolle
|
||||
-weight - ? (float)
|
||||
-iterations - ? (int)
|
||||
-total_variation
|
||||
-weight - Denoising weight. (float)
|
||||
|
||||
-sharpen
|
||||
-kernel - ? (numpy.matrix)
|
||||
|
||||
-unsharp mask
|
||||
-strength - ? (float)
|
||||
-ksize - kernel size (int)
|
||||
-block_match
|
||||
-sigma - ? (?)
|
||||
|
||||
-unsharp mask scikit
|
||||
-radius - ? (int)
|
||||
-amount - ? (float)
|
||||
-radius - Radius of the gaussian filter (int)
|
||||
-amount - Strength of the unsharp mask (float)
|
||||
|
||||
-morph
|
||||
-kernel - ? (numpy.matrix)
|
||||
-iterations - ? (int)
|
||||
-op - opencv MORPH operation (MORPH_OPEN, MORPH_CLOSE,
|
||||
MORPH_DILATE, MORPH_ERODE)
|
||||
-anchor - ? (tuple)
|
||||
-farid
|
||||
|
||||
-meijering
|
||||
|
||||
-sato
|
||||
|
||||
-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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user