diff --git a/bob/bio/vein/extractor/RepeatedLineTracking.py b/bob/bio/vein/extractor/RepeatedLineTracking.py index c3c5d6ad2923cd298c7357dab6cc40924a6b9708..84074aff73c3760795626b6e516f00aff9a1fcef 100644 --- a/bob/bio/vein/extractor/RepeatedLineTracking.py +++ b/bob/bio/vein/extractor/RepeatedLineTracking.py @@ -85,10 +85,11 @@ class RepeatedLineTracking (Extractor): hWo = numpy.round(hW*math.sqrt(2)/2) # half width for oblique directions # Omit unreachable borders - finger_mask[0:self.r+hW,:] = 0 - finger_mask[finger_mask.shape[0]-(self.r+hW):,:] = 0 - finger_mask[:,0:self.r+hW] = 0 - finger_mask[:,finger_mask.shape[1]-(self.r+hW):] = 0 + border = int(self.r+hW) + finger_mask[0:border,:] = 0 + finger_mask[finger_mask.shape[0]-border:,:] = 0 + finger_mask[:,0:border] = 0 + finger_mask[:,finger_mask.shape[1]-border:] = 0 ## Uniformly distributed starting points aux = numpy.argwhere( (finger_mask > 0) == True ) @@ -153,7 +154,7 @@ class RepeatedLineTracking (Extractor): else: # Left direction xp = Nc[i,0] - self.r - Vdepths[i] = finger_image[yp + hW, xp] - 2*finger_image[yp,xp] + finger_image[yp - hW, xp] + Vdepths[i] = finger_image[int(yp + hW), int(xp)] - 2*finger_image[int(yp),int(xp)] + finger_image[int(yp - hW), int(xp)] elif (Nc[i,0] == xc): # Vertical plane xp = Nc[i,0] @@ -163,7 +164,7 @@ class RepeatedLineTracking (Extractor): else: # Up direction yp = Nc[i,1] - self.r - Vdepths[i] = finger_image[yp, xp + hW] - 2*finger_image[yp,xp] + finger_image[yp, xp - hW] + Vdepths[i] = finger_image[int(yp), int(xp + hW)] - 2*finger_image[int(yp),int(xp)] + finger_image[int(yp), int(xp - hW)] ## Oblique directions if ( (Nc[i,0] > xc) and (Nc[i,1] < yc) ) or ( (Nc[i,0] < xc) and (Nc[i,1] > yc) ): @@ -176,7 +177,7 @@ class RepeatedLineTracking (Extractor): # Bottom left xp = Nc[i,0] - ro yp = Nc[i,1] + ro - Vdepths[i] = finger_image[yp - hWo, xp - hWo] - 2*finger_image[yp,xp] + finger_image[yp + hWo, xp + hWo] + Vdepths[i] = finger_image[int(yp - hWo), int(xp - hWo)] - 2*finger_image[int(yp),int(xp)] + finger_image[int(yp + hWo), int(xp + hWo)] else: # Diagonal, down \ if (Nc[i,0] < xc and Nc[i,1] < yc): @@ -187,7 +188,7 @@ class RepeatedLineTracking (Extractor): # Bottom right xp = Nc[i,0] + ro yp = Nc[i,1] + ro - Vdepths[i] = finger_image[yp + hWo, xp - hWo] - 2*finger_image[yp,xp] + finger_image[yp - hWo, xp + hWo] + Vdepths[i] = finger_image[int(yp + hWo), int(xp - hWo)] - 2*finger_image[int(yp),int(xp)] + finger_image[int(yp - hWo), int(xp + hWo)] # End search of candidates index = numpy.argmax(Vdepths) #Determine best candidate # Register tracking information diff --git a/bob/bio/vein/preprocessor/FingerCrop.py b/bob/bio/vein/preprocessor/FingerCrop.py index f6dbd2e636c299df9be8d183a0aeaff1760c32e8..a634948db83cf11c9b6248c42858f5d36396a2b3 100644 --- a/bob/bio/vein/preprocessor/FingerCrop.py +++ b/bob/bio/vein/preprocessor/FingerCrop.py @@ -285,11 +285,11 @@ class FingerCrop (Preprocessor): img_h,img_w = image.shape # Determine lower half starting point - half_img_h = img_h/2 + half_img_h = int(img_h/2) # Construct mask for filtering mask = numpy.ones((self.mask_h,self.mask_w), dtype='float64') - mask[(self.mask_h/2):,:] = -1.0 + mask[int(self.mask_h/2):,:] = -1.0 img_filt = utils.imfilter(image, mask)