Skip to content
Snippets Groups Projects
Commit 2effc8f4 authored by David GEISSBUHLER's avatar David GEISSBUHLER
Browse files

Merge branch 'ref_image' into 'master'

Added an optional reference image to Galbally IQM

See merge request !12
parents 5eabfafc a1cb6d55
No related branches found
No related tags found
1 merge request!12Added an optional reference image to Galbally IQM
Pipeline #
......@@ -18,9 +18,9 @@ image quality-features computed for the input image
measure.
"""
def compute_quality_features(image):
"""Extract a set of image quality-features computed for the input image.
def convert_rgb_image_to_gray(image):
"""
This function converts RGB input image to gray-scale.
Parameters:
......@@ -29,17 +29,12 @@ def compute_quality_features(image):
cols). If 2D, image should contain a gray-image of shape [M,N]. If 3D,
image should have a shape [3,M,N], and should contain an RGB-image.
Returns:
featSet (:py:class:`numpy.ndarray`): a 1D numpy array of 18 float32
scalars, each representing one image-quality measure. This function
returns a subset of the image-quality features (for face anti-spoofing)
that have been described by Galbally et al. in their paper:
"Image Quality Assessment for Fake Biometric Detection: Application to
Iris, Fingerprint, and Face Recognition", IEEE Trans. on Image
Processing Vol 23(2), 2014.
gray_image (:py:class:`numpy.ndarray`): A gray-scale image as
computed by matlab_rgb2gray function.
"""
gray_image = None
#print("shape of input image:")
# print(image.shape)
......@@ -57,12 +52,51 @@ def compute_quality_features(image):
else:
print('error -- wrong kind of input')
return gray_image
def compute_quality_features(image, smoothed = None):
"""Extract a set of image quality-features computed for the input image.
Parameters:
image (:py:class:`numpy.ndarray`): A ``uint8`` array with 2 or 3
dimensions, representing the input image of shape [M,N] (M rows x N
cols). If 2D, image should contain a gray-image of shape [M,N]. If 3D,
image should have a shape [3,M,N], and should contain an RGB-image.
smoothed None or :py:class:`numpy.ndarray`
A ``uint8`` array with 2 or 3 dimensions, representing the smoothed
version of the input image of shape [M,N] (M rows x N
cols). If 2D, image should contain a gray-image of shape [M,N]. If 3D,
image should have a shape [3,M,N], and should contain an RGB-image.
Default: None
Returns:
featSet (:py:class:`numpy.ndarray`): a 1D numpy array of 18 float32
scalars, each representing one image-quality measure. This function
returns a subset of the image-quality features (for face anti-spoofing)
that have been described by Galbally et al. in their paper:
"Image Quality Assessment for Fake Biometric Detection: Application to
Iris, Fingerprint, and Face Recognition", IEEE Trans. on Image
Processing Vol 23(2), 2014.
"""
gray_image = convert_rgb_image_to_gray(image)
if gray_image is not None:
gwin = gauss_2d((3, 3), 0.5) # set up the smoothing-filter
# print("computing degraded version of image")
smoothed = ssg.convolve2d(
gray_image, gwin, boundary='symm', mode='same')
if smoothed is None: # default behavior
gwin = gauss_2d((3, 3), 0.5) # set up the smoothing-filter
# print("computing degraded version of image")
smoothed = ssg.convolve2d(
gray_image, gwin, boundary='symm', mode='same')
else:
smoothed = convert_rgb_image_to_gray(smoothed)
"""
Some of the image-quality measures computed here require a reference
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment