wide_line_detector.py 1.83 KB
Newer Older
1 2
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
3
# Tue 27 Sep 2016 16:48:16 CEST
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

'''Huang's Wide-Line Detector and Miura Matching baseline

References:

1. [HDLTL10]_
2. [TV13]_
3. [TVM14]_

'''

sub_directory = 'wld'
"""Sub-directory where results will be placed.

You may change this setting using the ``--sub-directory`` command-line option
or the attribute ``sub_directory`` in a configuration file loaded **after**
this resource.
"""

23 24
from ..preprocessor import NoCropper, Padder, TomesLeeMask, \
    HuangNormalization, NoFilter, Preprocessor
25 26 27 28 29 30 31 32 33 34

# Filter sizes for the vertical "high-pass" filter
FILTER_HEIGHT = 4
FILTER_WIDTH = 40

# Padding (to create a buffer during normalization)
PAD_WIDTH = 5
PAD_CONST = 51

preprocessor = Preprocessor(
35
    crop=NoCropper(),
36 37 38 39 40
    mask=TomesLeeMask(filter_height=FILTER_HEIGHT, filter_width=FILTER_WIDTH),
    normalize=HuangNormalization(padding_width=PAD_WIDTH,
      padding_constant=PAD_CONST),
    filter=NoFilter(),
    )
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
"""Preprocessing using gray-level based finger cropping and no post-processing
"""

from ..extractor import WideLineDetector

# Radius of the circular neighbourhood region
RADIUS_NEIGHBOURHOOD_REGION = 5
NEIGHBOURHOOD_THRESHOLD = 1

#Sum of neigbourhood threshold
SUM_NEIGHBOURHOOD = 41
RESCALE = True

extractor = WideLineDetector(
    radius=RADIUS_NEIGHBOURHOOD_REGION,
    threshold=NEIGHBOURHOOD_THRESHOLD,
    g=SUM_NEIGHBOURHOOD,
    rescale=RESCALE
    )
"""Features are the output of the maximum curvature algorithm, as described on
[HDLTL10]_.

Defaults taken from [TV13]_.
"""

# Notice the values of ch and cw are different than those from the
# repeated-line tracking **and** maximum curvature baselines.
from ..algorithm import MiuraMatch
algorithm = MiuraMatch(ch=18, cw=28)
"""Miura-matching algorithm with specific settings for search displacement

Defaults taken from [TV13]_.
"""