diff --git a/TODO b/TODO index 99eb5d31..58d62534 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,11 @@ blocking bugs ============= +- hist norm broken? + + hist match broken? + + - none! diff --git a/libvips/conversion/im_scale.c b/libvips/conversion/im_scale.c index 39b8fade..4c7ca058 100644 --- a/libvips/conversion/im_scale.c +++ b/libvips/conversion/im_scale.c @@ -78,8 +78,8 @@ im_scale( IMAGE *in, IMAGE *out ) */ if( !t || !(stats = im_stats( in )) ) return( -1 ); - mn = stats->coeff[0]; - mx = stats->coeff[1]; + mn = VIPS_MASK( stats, 0, 0 ); + mx = VIPS_MASK( stats, 1, 0 ); im_free_dmask( stats ); if( mn == mx ) diff --git a/libvips/histograms_lut/im_histeq.c b/libvips/histograms_lut/im_histeq.c index bcf4e395..2fe594a8 100644 --- a/libvips/histograms_lut/im_histeq.c +++ b/libvips/histograms_lut/im_histeq.c @@ -162,7 +162,7 @@ im_histnorm( IMAGE *in, IMAGE *out ) const guint64 px = VIPS_IMAGE_N_PELS( in ); DOUBLEMASK *stats; double *a, *b; - int i; + int y; IMAGE *t1; int fmt; @@ -175,9 +175,9 @@ im_histnorm( IMAGE *in, IMAGE *out ) /* Scale each channel by px / channel max */ - for( i = 0; i < in->Bands; i++ ) { - a[i] = px / stats->coeff[6 + 1 + 6*i]; - b[i] = 0; + for( y = 0; y < in->Bands; y++ ) { + a[y] = px / VIPS_MASK( stats, 1, y + 1 ); + b[y] = 0; } im_free_dmask( stats ); diff --git a/libvips/histograms_lut/im_histplot.c b/libvips/histograms_lut/im_histplot.c index db667eaf..a78b4f2a 100644 --- a/libvips/histograms_lut/im_histplot.c +++ b/libvips/histograms_lut/im_histplot.c @@ -105,8 +105,8 @@ normalise( IMAGE *in, IMAGE *out ) if( !(stats = im_stats( in )) ) return( -1 ); - min = stats->coeff[0]; - max = stats->coeff[1]; + min = VIPS_MASK( stats, 0, 0 ); + max = VIPS_MASK( stats, 1, 0 ); im_free_dmask( stats ); if( !(t1 = im_open_local( out, "im_histplot", "p" )) || diff --git a/libvips/include/vips/mask.h b/libvips/include/vips/mask.h index db422c7e..be8f3730 100644 --- a/libvips/include/vips/mask.h +++ b/libvips/include/vips/mask.h @@ -55,6 +55,8 @@ typedef struct im__DOUBLEMASK { char *filename; } DOUBLEMASK; +#define VIPS_MASK( M, X, Y ) ((M)->coeff[(X) + (Y) * (M)->xsize]) + INTMASK *im_create_imask( const char *filename, int xsize, int ysize ); INTMASK *im_create_imaskv( const char *filename, int xsize, int ysize, ... ); DOUBLEMASK *im_create_dmask( const char *filename, int xsize, int ysize ); diff --git a/python/try2.py b/python/try2.py index 014e39a4..cdb063ce 100755 --- a/python/try2.py +++ b/python/try2.py @@ -6,7 +6,6 @@ logging.basicConfig(level = logging.DEBUG) from vips8 import vips from gi.repository import Vips - Vips.cache_set_trace(True) try: diff --git a/python/try3.py b/python/try3.py new file mode 100755 index 00000000..07908100 --- /dev/null +++ b/python/try3.py @@ -0,0 +1,12 @@ +#!/usr/bin/python + +import sys +from vips8 import vips + +from gi.repository import Vips +Vips.cache_set_trace(True) + +a = vips.Image(sys.argv[1]) +print a.max() +print a.max() +