more convsep tests
This commit is contained in:
parent
d62bec6ecc
commit
1f85ef7fbb
12
TODO
12
TODO
@ -1,6 +1,14 @@
|
|||||||
- something screwy in compass def?
|
- try:
|
||||||
|
|
||||||
$ python2 ./test_convolution.py TestConvolution.test_x
|
vips gaussmat m2.v 2 0.1 --separable
|
||||||
|
vips convsep k2.jpg x2.jpg m2.v
|
||||||
|
eog x2.jpg
|
||||||
|
|
||||||
|
it's too bright ... because gaussmat makes a float mask by default, but
|
||||||
|
conv does an int convolution by default
|
||||||
|
|
||||||
|
rather than an --integer switch on gaussmat, should it take --precision
|
||||||
|
instead, and default to INT, like conv?
|
||||||
|
|
||||||
- configure should check for pygobject too
|
- configure should check for pygobject too
|
||||||
|
|
||||||
|
@ -142,5 +142,27 @@ class TestConvolution(unittest.TestCase):
|
|||||||
true = compass(im, msk, 24, 49, times, operator.add)
|
true = compass(im, msk, 24, 49, times, operator.add)
|
||||||
self.assertAlmostEqualObjects(result, true)
|
self.assertAlmostEqualObjects(result, true)
|
||||||
|
|
||||||
|
def test_convsep(self):
|
||||||
|
for im in self.all_images:
|
||||||
|
for prec in [Vips.Precision.INTEGER, Vips.Precision.FLOAT]:
|
||||||
|
integer = prec == Vips.Precision.INTEGER
|
||||||
|
gmask = Vips.Image.gaussmat(2, 0.1,
|
||||||
|
integer = integer)
|
||||||
|
gmask_sep = Vips.Image.gaussmat(2, 0.1,
|
||||||
|
separable = True,
|
||||||
|
integer = integer)
|
||||||
|
|
||||||
|
self.assertEqual(gmask.width, gmask.height)
|
||||||
|
self.assertEqual(gmask_sep.width, gmask.width)
|
||||||
|
self.assertEqual(gmask_sep.height, 1)
|
||||||
|
|
||||||
|
a = im.conv(gmask, precision = prec)
|
||||||
|
b = im.convsep(gmask_sep, precision = prec)
|
||||||
|
|
||||||
|
a_point = a.getpoint(25, 50)
|
||||||
|
b_point = b.getpoint(25, 50)
|
||||||
|
|
||||||
|
self.assertAlmostEqualObjects(a_point, b_point, places = 1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user