fix matlab load
oops, width and height were swapped
This commit is contained in:
parent
04692c29dd
commit
a75ddfbd5a
@ -1,3 +1,6 @@
|
||||
21/8/14 started 7.40.7
|
||||
- fix matlab load
|
||||
|
||||
12/8/14 started 7.40.6
|
||||
- more doc fixes
|
||||
- fix similarity rotate+scale, thanks Topochicho
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# also update the version number in the m4 macros below
|
||||
|
||||
AC_INIT([vips], [7.40.6], [vipsip@jiscmail.ac.uk])
|
||||
AC_INIT([vips], [7.40.7], [vipsip@jiscmail.ac.uk])
|
||||
# required for gobject-introspection
|
||||
AC_PREREQ(2.62)
|
||||
|
||||
@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
# user-visible library versioning
|
||||
m4_define([vips_major_version], [7])
|
||||
m4_define([vips_minor_version], [40])
|
||||
m4_define([vips_micro_version], [6])
|
||||
m4_define([vips_micro_version], [7])
|
||||
m4_define([vips_version],
|
||||
[vips_major_version.vips_minor_version.vips_micro_version])
|
||||
|
||||
@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
|
||||
# binary interface changes not backwards compatible?: reset age to 0
|
||||
|
||||
LIBRARY_CURRENT=38
|
||||
LIBRARY_REVISION=4
|
||||
LIBRARY_REVISION=5
|
||||
LIBRARY_AGE=0
|
||||
|
||||
# patched into include/vips/version.h
|
||||
|
@ -4,6 +4,9 @@
|
||||
* - transpose on load, assemble planes into bands (thanks Mikhail)
|
||||
* 20/12/11
|
||||
* - reworked as some fns ready for new-style classes
|
||||
* 21/8/14
|
||||
* - swap width/height
|
||||
* - set interpretation to rgb16 etc.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -150,6 +153,28 @@ static int mat2vips_formats[][2] = {
|
||||
{ MAT_C_DOUBLE, VIPS_FORMAT_DOUBLE }
|
||||
};
|
||||
|
||||
/* Pick an interpretation.
|
||||
*/
|
||||
static VipsInterpretation
|
||||
mat2vips_pick_interpretation( int bands, VipsBandFormat format )
|
||||
{
|
||||
if( bands == 3 &&
|
||||
vips_band_format_is8bit( format ) )
|
||||
return( VIPS_INTERPRETATION_sRGB );
|
||||
if( bands == 3 &&
|
||||
(format == VIPS_FORMAT_USHORT ||
|
||||
format == VIPS_FORMAT_SHORT) )
|
||||
return( VIPS_INTERPRETATION_RGB16 );
|
||||
if( bands == 1 &&
|
||||
(format == VIPS_FORMAT_USHORT ||
|
||||
format == VIPS_FORMAT_SHORT) )
|
||||
return( VIPS_INTERPRETATION_GREY16 );
|
||||
if( bands > 1 )
|
||||
return( VIPS_INTERPRETATION_MULTIBAND );
|
||||
|
||||
return( VIPS_INTERPRETATION_MULTIBAND );
|
||||
}
|
||||
|
||||
static int
|
||||
mat2vips_get_header( matvar_t *var, VipsImage *im )
|
||||
{
|
||||
@ -165,10 +190,10 @@ mat2vips_get_header( matvar_t *var, VipsImage *im )
|
||||
bands = var->dims[2];
|
||||
|
||||
case 2:
|
||||
height = var->dims[1];
|
||||
width = var->dims[1];
|
||||
|
||||
case 1:
|
||||
width = var->dims[0];
|
||||
height = var->dims[0];
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -177,11 +202,6 @@ mat2vips_get_header( matvar_t *var, VipsImage *im )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if( bands > 1 )
|
||||
interpretation = VIPS_INTERPRETATION_MULTIBAND;
|
||||
else
|
||||
interpretation = VIPS_INTERPRETATION_B_W;
|
||||
|
||||
for( i = 0; i < VIPS_NUMBER( mat2vips_formats ); i++ )
|
||||
if( mat2vips_formats[i][0] == var->class_type )
|
||||
break;
|
||||
@ -191,6 +211,7 @@ mat2vips_get_header( matvar_t *var, VipsImage *im )
|
||||
return( -1 );
|
||||
}
|
||||
format = mat2vips_formats[i][1];
|
||||
interpretation = mat2vips_pick_interpretation( bands, format );
|
||||
|
||||
vips_image_init_fields( im,
|
||||
width, height, bands,
|
||||
|
Loading…
Reference in New Issue
Block a user