Coverage for src/bob/bio/vein/config/maximum_curvature.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:32 CEST 

4 

5"""Maximum Curvature and Miura Matching baseline 

6 

7References: 

8 

91. [MNM05]_ 

102. [TV13]_ 

113. [TVM14]_ 

12 

13""" 

14 

15import os 

16import tempfile 

17 

18from sklearn.pipeline import make_pipeline 

19 

20from bob.bio.base.pipelines import PipelineSimple 

21from bob.bio.base.transformers import ( 

22 ExtractorTransformer, 

23 PreprocessorTransformer, 

24) 

25from bob.bio.vein.algorithm import MiuraMatch 

26from bob.bio.vein.extractor import MaximumCurvature 

27from bob.bio.vein.preprocessor import ( 

28 HuangNormalization, 

29 NoCrop, 

30 NoFilter, 

31 Preprocessor, 

32 TomesLeeMask, 

33) 

34from bob.pipelines import wrap 

35 

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

37 

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

39sub_directory = "rlt" 

40 

41default_temp = ( 

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

43 if "USER" in os.environ 

44 else "~/temp" 

45) 

46 

47if os.path.exists(default_temp): 

48 legacy_temp_dir = os.path.join( 

49 default_temp, "bob_bio_base_tmp", sub_directory 

50 ) 

51else: 

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

53 legacy_temp_dir = tempfile.TemporaryDirectory().name 

54 

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

56""" 

57preprocessor = PreprocessorTransformer( 

58 Preprocessor( 

59 crop=NoCrop(), 

60 mask=TomesLeeMask(), 

61 normalize=HuangNormalization(), 

62 filter=NoFilter(), 

63 ) 

64) 

65 

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

67[MNM05]_. 

68 

69Defaults taken from [TV13]_. 

70""" 

71extractor = ExtractorTransformer(MaximumCurvature()) 

72 

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

74 

75Defaults taken from [TV13]_. 

76""" 

77biometric_algorithm = MiuraMatch() 

78 

79transformer = make_pipeline( 

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

81) 

82pipeline = PipelineSimple(transformer, biometric_algorithm)