Coverage for src/bob/bio/vein/config/wide_line_detector.py: 0%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2024-07-12 23:27 +0200

1#!/usr/bin/env python 

2# vim: set fileencoding=utf-8 : 

3# Tue 27 Sep 2016 16:48:16 CEST 

4 

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

6 

7References: 

8 

91. [HDLTL10]_ 

102. [TV13]_ 

113. [TVM14]_ 

12 

13""" 

14import os 

15import tempfile 

16 

17from sklearn.pipeline import make_pipeline 

18 

19from bob.bio.base.pipelines import PipelineSimple 

20from bob.bio.base.transformers import ( 

21 ExtractorTransformer, 

22 PreprocessorTransformer, 

23) 

24from bob.bio.vein.algorithm import MiuraMatch 

25from bob.bio.vein.extractor import WideLineDetector 

26from bob.bio.vein.preprocessor import ( 

27 HuangNormalization, 

28 NoCrop, 

29 NoFilter, 

30 Preprocessor, 

31 TomesLeeMask, 

32) 

33from bob.pipelines import wrap 

34 

35"""Baseline updated with the wrapper for the pipelines package""" 

36 

37"""Sub-directory where temporary files are saved""" 

38sub_directory = "wld" 

39default_temp = ( 

40 os.path.join("/idiap", "temp", os.environ["USER"]) 

41 if "USER" in os.environ 

42 else "~/temp" 

43) 

44 

45if os.path.exists(default_temp): 

46 legacy_temp_dir = os.path.join( 

47 default_temp, "bob_bio_base_tmp", sub_directory 

48 ) 

49else: 

50 # if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx 

51 legacy_temp_dir = tempfile.TemporaryDirectory().name 

52 

53"""Preprocessing using gray-level based finger cropping and no post-processing 

54""" 

55preprocessor = PreprocessorTransformer( 

56 Preprocessor( 

57 crop=NoCrop(), 

58 mask=TomesLeeMask(), 

59 normalize=HuangNormalization(), 

60 filter=NoFilter(), 

61 ) 

62) 

63 

64"""Features are the output of the maximum curvature algorithm, as described on 

65[HDLTL10]_. 

66 

67Defaults taken from [TV13]_. 

68""" 

69extractor = ExtractorTransformer(WideLineDetector()) 

70 

71 

72"""Miura-matching algorithm with specific settings for search displacement 

73 

74Defaults taken from [TV13]_. 

75""" 

76# Notice the values of ch and cw are different than those from the 

77# repeated-line tracking **and** maximum curvature baselines. 

78biometric_algorithm = MiuraMatch(ch=18, cw=28) 

79 

80transformer = make_pipeline( 

81 wrap(["sample"], preprocessor), wrap(["sample"], extractor) 

82) 

83pipeline = PipelineSimple(transformer, biometric_algorithm)