fix hist normalisation
hist norm was broken due to the VipsStats width change
This commit is contained in:
parent
ef19ecc923
commit
6ba96b2333
5
TODO
5
TODO
@ -1,6 +1,11 @@
|
|||||||
blocking bugs
|
blocking bugs
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
- hist norm broken?
|
||||||
|
|
||||||
|
hist match broken?
|
||||||
|
|
||||||
|
|
||||||
- none!
|
- none!
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ im_scale( IMAGE *in, IMAGE *out )
|
|||||||
*/
|
*/
|
||||||
if( !t || !(stats = im_stats( in )) )
|
if( !t || !(stats = im_stats( in )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
mn = stats->coeff[0];
|
mn = VIPS_MASK( stats, 0, 0 );
|
||||||
mx = stats->coeff[1];
|
mx = VIPS_MASK( stats, 1, 0 );
|
||||||
im_free_dmask( stats );
|
im_free_dmask( stats );
|
||||||
|
|
||||||
if( mn == mx )
|
if( mn == mx )
|
||||||
|
@ -162,7 +162,7 @@ im_histnorm( IMAGE *in, IMAGE *out )
|
|||||||
const guint64 px = VIPS_IMAGE_N_PELS( in );
|
const guint64 px = VIPS_IMAGE_N_PELS( in );
|
||||||
DOUBLEMASK *stats;
|
DOUBLEMASK *stats;
|
||||||
double *a, *b;
|
double *a, *b;
|
||||||
int i;
|
int y;
|
||||||
IMAGE *t1;
|
IMAGE *t1;
|
||||||
int fmt;
|
int fmt;
|
||||||
|
|
||||||
@ -175,9 +175,9 @@ im_histnorm( IMAGE *in, IMAGE *out )
|
|||||||
|
|
||||||
/* Scale each channel by px / channel max
|
/* Scale each channel by px / channel max
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < in->Bands; i++ ) {
|
for( y = 0; y < in->Bands; y++ ) {
|
||||||
a[i] = px / stats->coeff[6 + 1 + 6*i];
|
a[y] = px / VIPS_MASK( stats, 1, y + 1 );
|
||||||
b[i] = 0;
|
b[y] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
im_free_dmask( stats );
|
im_free_dmask( stats );
|
||||||
|
@ -105,8 +105,8 @@ normalise( IMAGE *in, IMAGE *out )
|
|||||||
|
|
||||||
if( !(stats = im_stats( in )) )
|
if( !(stats = im_stats( in )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
min = stats->coeff[0];
|
min = VIPS_MASK( stats, 0, 0 );
|
||||||
max = stats->coeff[1];
|
max = VIPS_MASK( stats, 1, 0 );
|
||||||
im_free_dmask( stats );
|
im_free_dmask( stats );
|
||||||
|
|
||||||
if( !(t1 = im_open_local( out, "im_histplot", "p" )) ||
|
if( !(t1 = im_open_local( out, "im_histplot", "p" )) ||
|
||||||
|
@ -55,6 +55,8 @@ typedef struct im__DOUBLEMASK {
|
|||||||
char *filename;
|
char *filename;
|
||||||
} DOUBLEMASK;
|
} 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_imask( const char *filename, int xsize, int ysize );
|
||||||
INTMASK *im_create_imaskv( 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 );
|
DOUBLEMASK *im_create_dmask( const char *filename, int xsize, int ysize );
|
||||||
|
@ -6,7 +6,6 @@ logging.basicConfig(level = logging.DEBUG)
|
|||||||
from vips8 import vips
|
from vips8 import vips
|
||||||
|
|
||||||
from gi.repository import Vips
|
from gi.repository import Vips
|
||||||
|
|
||||||
Vips.cache_set_trace(True)
|
Vips.cache_set_trace(True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
12
python/try3.py
Executable file
12
python/try3.py
Executable file
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user