mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-01 20:58:05 +08:00
fix test cases for local binary pattern
test results changed because border handling of bilinear interpolation changed
This commit is contained in:
@@ -154,49 +154,49 @@ class TestLBP():
|
||||
|
||||
def test_default(self):
|
||||
lbp = local_binary_pattern(self.image, 8, 1, 'default')
|
||||
ref = np.array([[ 0., 251., 0., 255., 96., 255.],
|
||||
[143., 0., 20., 153., 64., 184.],
|
||||
[254., 255., 12., 191., 0., 255.],
|
||||
ref = np.array([[ 0., 241., 0., 255., 96., 255.],
|
||||
[135., 0., 20., 153., 64., 56.],
|
||||
[198., 255., 12., 191., 0., 124.],
|
||||
[129., 64., 62., 159., 199., 0.],
|
||||
[255., 4., 255., 175., 0., 255.],
|
||||
[ 3., 5., 0., 223., 4., 24.]])
|
||||
[255., 4., 255., 175., 0., 124.],
|
||||
[ 3., 5., 0., 255., 4., 24.]])
|
||||
print lbp
|
||||
np.testing.assert_array_equal(lbp, ref)
|
||||
|
||||
def test_ror(self):
|
||||
lbp = local_binary_pattern(self.image, 8, 1, 'ror')
|
||||
ref = np.array([[ 0., 127., 0., 255., 3., 255.],
|
||||
[ 31., 0., 5., 51., 1., 23.],
|
||||
[127., 255., 3., 127., 0., 255.],
|
||||
[ 3., 1., 31., 63., 31., 0.],
|
||||
[255., 1., 255., 95., 0., 255.],
|
||||
[ 3., 5., 0., 255., 1., 11.]])
|
||||
ref = np.array([[ 0., 31., 0., 255., 3., 255.],
|
||||
[ 15., 0., 5., 51., 1., 7.],
|
||||
[ 27., 255., 3., 127., 0., 31.],
|
||||
[ 3., 1., 31., 63., 31., 0.],
|
||||
[255., 1., 255., 95., 0., 31.],
|
||||
[ 3., 5., 0., 255., 1., 3.]])
|
||||
np.testing.assert_array_equal(lbp, ref)
|
||||
|
||||
def test_uniform(self):
|
||||
lbp = local_binary_pattern(self.image, 8, 1, 'uniform')
|
||||
ref = np.array([[0., 7., 0., 8., 2., 8.],
|
||||
[5., 0., 9., 9., 1., 9.],
|
||||
[7., 8., 2., 7., 0., 8.],
|
||||
ref = np.array([[0., 5., 0., 8., 2., 8.],
|
||||
[4., 0., 9., 9., 1., 3.],
|
||||
[9., 8., 2., 7., 0., 5.],
|
||||
[2., 1., 5., 6., 5., 0.],
|
||||
[8., 1., 8., 9., 0., 8.],
|
||||
[8., 1., 8., 9., 0., 5.],
|
||||
[2., 9., 0., 8., 1., 2.]])
|
||||
np.testing.assert_array_equal(lbp, ref)
|
||||
|
||||
def test_var(self):
|
||||
lbp = local_binary_pattern(self.image, 8, 1, 'var')
|
||||
print lbp
|
||||
ref = np.array([[0. , 0.00072786, 0. , 0.00115376,
|
||||
0.00032355, 0.00252394],
|
||||
[0.0005506 , 0. , 0.00263827, 0.00163246,
|
||||
0.00027414, 0.00144944],
|
||||
[0.00195733, 0.00130368, 0.00042095, 0.00171893,
|
||||
0. , 0.00145748],
|
||||
[0.00025994, 0.00019464, 0.00082291, 0.00225383,
|
||||
ref = np.array([[0. , 0.00039254, 0. , 0.00089309,
|
||||
0.00030782, 0.00203232],
|
||||
[0.00037561, 0. , 0.00263827, 0.00163246,
|
||||
0.00027414, 0.00039593],
|
||||
[0.00170876, 0.00130368, 0.00042095, 0.00171893,
|
||||
0. , 0.00044912],
|
||||
[0.00021898, 0.00019464, 0.00082291, 0.00225383,
|
||||
0.00076696, 0. ],
|
||||
[0.00232001, 0.00013236, 0.0009134 , 0.0014467 ,
|
||||
0. , 0.00179251],
|
||||
[0.00027995, 0.0012277 , 0, 0.00109869,
|
||||
0.00015445, 0.00037256]])
|
||||
[0.00079791, 0.00013236, 0.0009134 , 0.0014467 ,
|
||||
0. , 0.00046857],
|
||||
[0.00022553, 0.00089319, 0. , 0.00089274,
|
||||
0.00013659, 0.00031981]])
|
||||
np.testing.assert_array_almost_equal(lbp, ref)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user