Merge branch '8.2'

This commit is contained in:
John Cupitt 2016-03-06 18:05:12 +00:00
commit 9201248623
3 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,7 @@
27/1/16 started 8.2.3
- fix a crash with SPARC byte-order labq vips images
- fix parsing of filenames containing brackets, thanks shilpi230
- fix hist_entropy (lovell)
12/1/16 started 8.2.2
- changes to ease compiling C++ binding with MSVC [Lovell Fuller]

View File

@ -3,6 +3,8 @@
* Author: John Cupitt
* 11/8/15
* - from hist_ismonotonic.c
* 6/3/16
* - vips_log() call was mangled, thanks Lovell
*/
/*
@ -80,7 +82,7 @@ vips_hist_entropy_build( VipsObject *object )
return( -1 );
sum = avg * VIPS_IMAGE_N_PELS( entropy->in ) * entropy->in->Bands;
if( vips_linear1( entropy->in, &t[0], 1.0 / sum, 0, NULL ) ||
vips_log( t[0], &t[1], 1.0 / sum, 0, NULL ) ||
vips_log( t[0], &t[1], NULL ) ||
vips_linear1( t[1], &t[2], 1.0 / log( 2.0 ), 0, NULL ) ||
vips_multiply( t[0], t[2], &t[3], NULL ) ||
vips_avg( t[3], &avg, NULL ) )

View File

@ -101,7 +101,7 @@ class TestHistogram(unittest.TestCase):
self.assertEqual((im - im2).abs().max(), 0.0)
def test_hist_map(self):
def test_percent(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg").extract_band(1)
pc = im.percent(90)
@ -112,6 +112,13 @@ class TestHistogram(unittest.TestCase):
self.assertAlmostEqual(pc_set, 90, places = 0)
def test_hist_entropy(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg").extract_band(1)
ent = im.hist_find().hist_entropy()
self.assertAlmostEqual(ent, 4.367, places = 3)
def test_stdif(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg")