Adding remaining tests

This commit is contained in:
Ankit Agrawal
2013-08-15 15:15:41 +05:30
parent c3b6ce2c82
commit 6c27d278d0
2 changed files with 17 additions and 4 deletions
+3 -4
View File
@@ -192,11 +192,7 @@ def keypoints_censure(image, min_scale=1, max_scale=7, mode='DoB',
if image.ndim != 2:
raise ValueError("Only 2-D gray-scale images supported.")
image = img_as_float(image)
image = np.ascontiguousarray(image)
mode = mode.lower()
if mode not in ('dob', 'octagon', 'star'):
raise ValueError('Mode must be one of "DoB", "Octagon", "STAR".')
@@ -204,6 +200,9 @@ def keypoints_censure(image, min_scale=1, max_scale=7, mode='DoB',
raise ValueError('The number of scales should be greater than or'
'equal to 3.')
image = img_as_float(image)
image = np.ascontiguousarray(image)
# Generating all the scales
filter_response = _get_filtered_image(image, min_scale, max_scale, mode)
+14
View File
@@ -10,6 +10,20 @@ def test_keypoints_censure_color_image_unsupported_error():
assert_raises(ValueError, keypoints_censure, img)
def test_keypoints_censure_mode_validity_error():
"""Mode argument in keypoints_censure can be either DoB, Octagon or
STAR."""
img = np.zeros((20, 20))
assert_raises(ValueError, keypoints_censure, img, mode='dummy')
def test_keypoints_censure_scale_range_error():
"""Difference between the the max_scale and min_scale parameters in
keypoints_censure should be greater than or equal to two."""
img = np.zeros((20, 20))
assert_raises(ValueError, keypoints_censure, img, min_scale=1, max_scale=2)
def test_keypoints_censure_moon_image_dob():
"""Verify the actual Censure keypoints and their corresponding scale with
the expected values for DoB filter."""