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

21 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 Principal Curvature extractor and Miura Matching baseline 

6 

7References: 

8 

91. [HDLTL10]_ 

102. [TV13]_ 

113. [TVM14]_ 

12 

13""" 

14 

15from bob.bio.vein.preprocessor import ( 

16 HuangNormalization, 

17 NoCrop, 

18 NoFilter, 

19 Preprocessor, 

20 TomesLeeMask, 

21) 

22 

23legacy_preprocessor = Preprocessor( 

24 crop=NoCrop(), 

25 mask=TomesLeeMask(), 

26 normalize=HuangNormalization(), 

27 filter=NoFilter(), 

28) 

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

30""" 

31 

32 

33from bob.bio.vein.extractor import PrincipalCurvature 

34 

35legacy_extractor = PrincipalCurvature() 

36 

37 

38from sklearn.pipeline import make_pipeline 

39 

40from bob.bio.base.transformers import ( 

41 ExtractorTransformer, 

42 PreprocessorTransformer, 

43) 

44from bob.pipelines import wrap 

45 

46transformer = make_pipeline( 

47 wrap(["sample"], PreprocessorTransformer(legacy_preprocessor)), 

48 wrap(["sample"], ExtractorTransformer(legacy_extractor)), 

49) 

50 

51 

52from bob.bio.vein.algorithm import MiuraMatch 

53 

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

55 

56Defaults taken from [TV13]_. 

57""" 

58 

59import os 

60import tempfile 

61 

62sub_directory = "pc" 

63 

64default_temp = ( 

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

66 if "USER" in os.environ 

67 else "~/temp" 

68) 

69 

70if os.path.exists(default_temp): 

71 legacy_temp_dir = os.path.join( 

72 default_temp, "bob_bio_base_tmp", sub_directory 

73 ) 

74else: 

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

76 legacy_temp_dir = tempfile.TemporaryDirectory().name 

77 

78 

79from bob.bio.base.pipelines import PipelineSimple 

80 

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

82 

83pipeline = PipelineSimple(transformer, biometric_algorithm)