Commit 33a2ae79 authored by David GEISSBUHLER's avatar David GEISSBUHLER

Added test for remove_highlights_orig

parent 213096f8
......@@ -18,6 +18,9 @@ import bob.ip.color
from . import galbally_iqm_features as iqm
from . import msu_iqa_features as iqa
from bob.io import image
from ._library_orig import remove_highlights_orig
REF_VIDEO_FILE = 'real_client001_android_SD_scene01.mp4'
REF_FEATURE_FILE = 'real_client001_android_SD_scene01_ref_feats.h5'
......@@ -106,3 +109,30 @@ def test_msu_feat_extr():
# test: compare feature-values in bobfset[] with those loaded from hdf5 file
nose.tools.assert_true((msufset == msu_ref_features).all())
# test if the original version of the specular highlights algorithm
# (remove_highlights_orig.cpp::remove_highlights_orig) performs exactly
# like the original code from which it was mostly copied.
# (this test can probabalty be dropped.)
def test_remove_highlights_orig_integrity():
# open pictures
img1 = image.load(F('old_man.ppm'))
img2 = image.load(F('toys.ppm'))
# compute
sfi1, diff1, residue1 = remove_highlights_orig(img1.astype(np.float32), 0.5)
sfi2, diff2, residue2 = remove_highlights_orig(img2.astype(np.float32), 0.5)
#speckleImg[np.where(np.isinf(speckleImg))] = 0
#speckleImg[np.where(np.isnan(speckleImg))] = 0
diff1_u8 = diff1.astype('uint8')
diff2_u8 = diff2.astype('uint8')
# reference files
ref1 = image.load(F('old_man_diffuse.ppm'))
ref2 = image.load(F('toys_diffuse.ppm'))
# test: compare results
nose.tools.assert_true((diff1_u8 == ref1).all())
nose.tools.assert_true((diff2_u8 == ref2).all())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment