Skip to content
Snippets Groups Projects
Commit 1f98d92e authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Merge branch 'Issue#13' into 'master'

Issue #13

Closes #13

See merge request !25
parents a1c39a80 989ad53c
No related branches found
No related tags found
1 merge request!25Issue #13
Pipeline #
...@@ -36,10 +36,6 @@ class MaximumCurvature (Extractor): ...@@ -36,10 +36,6 @@ class MaximumCurvature (Extractor):
"""Computes and returns the Maximum Curvature features for the given input """Computes and returns the Maximum Curvature features for the given input
fingervein image""" fingervein image"""
if image.dtype != numpy.uint8:
image = bob.core.convert(image,numpy.uint8,(0,255),(0,1))
#No es necesario pasarlo a uint8, en matlab lo dejan en float64. Comprobar si varian los resultados en vera database y ajustar.
finger_mask = numpy.zeros(mask.shape) finger_mask = numpy.zeros(mask.shape)
finger_mask[mask == True] = 1 finger_mask[mask == True] = 1
......
...@@ -55,10 +55,6 @@ class RepeatedLineTracking (Extractor): ...@@ -55,10 +55,6 @@ class RepeatedLineTracking (Extractor):
# Sets the random seed before starting to process # Sets the random seed before starting to process
numpy.random.seed(self.seed) numpy.random.seed(self.seed)
#Convert image to uint8
if finger_image.dtype != numpy.uint8:
finger_image = bob.core.convert(finger_image,numpy.uint8,(0,255),(0,1))
finger_mask = numpy.zeros(mask.shape) finger_mask = numpy.zeros(mask.shape)
finger_mask[mask == True] = 1 finger_mask[mask == True] = 1
......
...@@ -30,7 +30,7 @@ def F(parts): ...@@ -30,7 +30,7 @@ def F(parts):
"""Returns the test file path""" """Returns the test file path"""
return pkg_resources.resource_filename(__name__, os.path.join(*parts)) return pkg_resources.resource_filename(__name__, os.path.join(*parts))
def test_finger_crop(): def test_finger_crop():
...@@ -44,7 +44,6 @@ def test_finger_crop(): ...@@ -44,7 +44,6 @@ def test_finger_crop():
from bob.bio.vein.preprocessor.FingerCrop import FingerCrop from bob.bio.vein.preprocessor.FingerCrop import FingerCrop
preprocess = FingerCrop(fingercontour='leemaskMatlab', padding_width=0) preprocess = FingerCrop(fingercontour='leemaskMatlab', padding_width=0)
preproc, mask = preprocess(img) preproc, mask = preprocess(img)
#preprocessor_utils.show_mask_over_image(preproc, mask) #preprocessor_utils.show_mask_over_image(preproc, mask)
...@@ -84,6 +83,24 @@ def test_max_curvature(): ...@@ -84,6 +83,24 @@ def test_max_curvature():
assert numpy.mean(numpy.abs(output_img - output_img_ref)) < 8e-3 assert numpy.mean(numpy.abs(output_img - output_img_ref)) < 8e-3
def test_max_curvature_HE():
# Maximum Curvature method when Histogram Equalization post-processing is applied to the preprocessed vein image
# Read in input image
input_img_filename = F(('preprocessors', '0019_3_1_120509-160517.png'))
input_img = bob.io.base.load(input_img_filename)
# Preprocess the data and apply Histogram Equalization postprocessing (same parameters as in maximum_curvature.py configuration file + postprocessing)
from bob.bio.vein.preprocessor.FingerCrop import FingerCrop
FC = FingerCrop(postprocessing = 'HE')
preproc_data = FC(input_img)
# Extract features from preprocessed and histogram equalized data using MC extractor (same parameters as in maximum_curvature.py configuration file)
from bob.bio.vein.extractor.MaximumCurvature import MaximumCurvature
MC = MaximumCurvature(sigma = 5)
extr_data = MC(preproc_data)
def test_repeated_line_tracking(): def test_repeated_line_tracking():
#Repeated Line Tracking method against Matlab reference #Repeated Line Tracking method against Matlab reference
...@@ -109,6 +126,30 @@ def test_repeated_line_tracking(): ...@@ -109,6 +126,30 @@ def test_repeated_line_tracking():
assert numpy.mean(numpy.abs(output_img - output_img_ref)) < 0.5 assert numpy.mean(numpy.abs(output_img - output_img_ref)) < 0.5
def test_repeated_line_tracking_HE():
# Repeated Line Tracking method when Histogram Equalization post-processing is applied to the preprocessed vein image
# Read in input image
input_img_filename = F(('preprocessors', '0019_3_1_120509-160517.png'))
input_img = bob.io.base.load(input_img_filename)
# Preprocess the data and apply Histogram Equalization postprocessing (same parameters as in repeated_line_tracking.py configuration file + postprocessing)
from bob.bio.vein.preprocessor.FingerCrop import FingerCrop
FC = FingerCrop(postprocessing = 'HE')
preproc_data = FC(input_img)
# Extract features from preprocessed and histogram equalized data using RLT extractor (same parameters as in repeated_line_tracking.py configuration file)
from bob.bio.vein.extractor.RepeatedLineTracking import RepeatedLineTracking
# Maximum number of iterations
NUMBER_ITERATIONS = 3000
# Distance between tracking point and cross section of profile
DISTANCE_R = 1
# Width of profile
PROFILE_WIDTH = 21
RLT = RepeatedLineTracking(iterations = NUMBER_ITERATIONS, r = DISTANCE_R, profile_w = PROFILE_WIDTH, seed = 0)
extr_data = RLT(preproc_data)
def test_wide_line_detector(): def test_wide_line_detector():
#Wide Line Detector method against Matlab reference #Wide Line Detector method against Matlab reference
...@@ -133,6 +174,30 @@ def test_wide_line_detector(): ...@@ -133,6 +174,30 @@ def test_wide_line_detector():
assert numpy.allclose(output_img, output_img_ref) assert numpy.allclose(output_img, output_img_ref)
def test_wide_line_detector_HE():
# Wide Line Detector method when Histogram Equalization post-processing is applied to the preprocessed vein image
# Read in input image
input_img_filename = F(('preprocessors', '0019_3_1_120509-160517.png'))
input_img = bob.io.base.load(input_img_filename)
# Preprocess the data and apply Histogram Equalization postprocessing (same parameters as in wide_line_detector.py configuration file + postprocessing)
from bob.bio.vein.preprocessor.FingerCrop import FingerCrop
FC = FingerCrop(postprocessing = 'HE')
preproc_data = FC(input_img)
# Extract features from preprocessed and histogram equalized data using WLD extractor (same parameters as in wide_line_detector.py configuration file)
from bob.bio.vein.extractor.WideLineDetector import WideLineDetector
# Radius of the circular neighbourhood region
RADIUS_NEIGHBOURHOOD_REGION = 5
NEIGHBOURHOOD_THRESHOLD = 1
# Sum of neigbourhood threshold
SUM_NEIGHBOURHOOD = 41
RESCALE = True
WLD = WideLineDetector(radius = RADIUS_NEIGHBOURHOOD_REGION, threshold = NEIGHBOURHOOD_THRESHOLD, g = SUM_NEIGHBOURHOOD, rescale = RESCALE)
extr_data = WLD(preproc_data)
def test_miura_match(): def test_miura_match():
#Match Ratio method against Matlab reference #Match Ratio method against Matlab reference
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment