This commit is contained in:
John Cupitt 2008-02-29 18:37:05 +00:00
parent a0882e378a
commit 187754bfd9
7 changed files with 178 additions and 66 deletions

View File

@ -16,6 +16,8 @@
- add im_align_bands
- fix type overflow in complex division
- fix im_cross_phase and im_addgnoise (Tom)
- updated docs, C++ and python
- header no longer stops on error
12/12/07 started 7.13.3
- added "include <cstring>" to VImage.cc to help gcc 4.3

10
TODO
View File

@ -14,6 +14,16 @@
WONTFIX
=======
- unsharp should work on GREY16? shuld be easy to add GREY16->LABS
no, labs is signed short, ranges are all differrent, and the scaling will be
wrong anyway
correct: import with ICC to labs, then process, then export to RGB, take
green?
yuk, can we add a 16bit path to vips's lab <--> rgb converter?
- test maxpos_avg, quite a few changes
- write our own python extension to call a vips operation by name

View File

@ -180,11 +180,12 @@ if test x"$with_fftw3" != "xno"; then
fi
# ImageMagick ... detect attribute iteration too
# Optionally look for GraphicsMagick instead
# Optionally look for GraphicsMagick instead ... use
# --with-magickpackage=GraphicsMagick
AC_ARG_WITH([magick], AS_HELP_STRING([--without-magick], [build without libMagic (default: test)]))
AC_ARG_WITH([magickpackage], AS_HELP_STRING([--with-magickpackage], [magickpackage to use (default: ImageMagick)]))
if test x"$with_magickpackage" == "xno"; then
if test x"$with_magickpackage" == "x"; then
with_magickpackage=ImageMagick
fi

View File

@ -29,9 +29,11 @@ im_asintra - asin of image (result in degrees)
im_atantra - atan of image (result in degrees)
im_avg - average value of image
im_point_bilinear - interpolate value at single point, linearly
im_bandmean - average image bands
im_ceil - round to smallest integal value not less than
im_cmulnorm - multiply two complex images, normalising output
im_costra - cos of image (angles in degrees)
im_cross_phase - phase of cross power spectrum of two complex images
im_deviate - standard deviation of image
im_divide - divide two images
im_exp10tra - 10^pel of image
@ -49,17 +51,19 @@ im_litecor - calculate max(white)*factor*(in/white), if clip == 1
im_log10tra - log10 of image
im_logtra - ln of image
im_max - maximum value of image
im_maxpos - position of maximum in image
im_maxpos_avg - position of maximum, averaging in case of draw
im_maxpos - position of image max
im_maxpos_avg - position of image max, averagie in case of draw
im_maxpos_vec - position and value of n maxima of image
im_measure - measure averages of a grid of patches
im_min - minimum value of image
im_minpos - position of minimum value of image
im_minpos_vec - position and value of n minima of image
im_multiply - multiply two images
im_powtra - pel^x ofbuildimage
im_powtra_vec - pel^[x,y,z] of image
im_remainder - remainder after integer division
im_remainderconst - remainder after integer division by a constant
im_remainderconst_vec - remainder after integer division by a vector
im_remainderconst_vec - remainder after integer division by vector
im_rint - round to nearest integal value
im_sign - unit vector in direction of value
im_sintra - sin of image (angles in degrees)
@ -326,7 +330,8 @@ im_flipver - flip image top-bottom
im_gbandjoin - bandwise join of many images
im_grid - chop a tall thin image into a grid of images
im_insert - insert sub-image into main image at position
im_insert_noexpand - insert sub-image into main image at position, no expansion
im_insert_noexpand - insert sub-image into main image at position, no
expansion
im_jpeg2vips - convert from jpeg
im_lrjoin - join two images left-right
im_magick2vips - load file with libMagick
@ -342,12 +347,6 @@ im_recomb - linear recombination with mask
im_replicate - replicate an image horizontally and vertically
im_ri2c - join two non-complex images to form complex
im_rot180 - rotate image 180 degrees
im_rot270 - rotate image 270 degrees clockwise
im_rot90 - rotate image 90 degrees clockwise
im_scale - scale image linearly to fit range 0-255
im_scaleps - logarithmic scale of image to fit range 0-255
im_rightshift_size - decrease size by a power-of-two factor
im_slice - slice an image using two thresholds
\end{verbatim}
\caption{Conversion functions}
\label{fg:conversion}
@ -355,6 +354,12 @@ im_slice - slice an image using two thresholds
\begin{fig2}
\begin{verbatim}
im_rot270 - rotate image 270 degrees clockwise
im_rot90 - rotate image 90 degrees clockwise
im_scale - scale image linearly to fit range 0-255
im_scaleps - logarithmic scale of image to fit range 0-255
im_rightshift_size - decrease size by a power-of-two factor
im_slice - slice an image using two thresholds
im_subsample - subsample image by integer factors
im_system - run command on image
im_tbjoin - join two images top-bottom
@ -368,6 +373,7 @@ im_vips2mimejpeg - convert to jpeg as mime type on stdout
im_vips2png - convert VIPS image to PNG file
im_vips2ppm - write a file in pbm/pgm/ppm format
im_vips2tiff - convert VIPS image to TIFF file
im_wrap - shift image origin, wrapping at sides
im_zoom - simple zoom of an image by integer factors
\end{verbatim}
\caption{Conversion functions (cont.)}
@ -490,19 +496,28 @@ im_convsep_raw - seperable convolution, no border
im_convsepf - seperable convolution, with DOUBLEMASK
im_convsepf_raw - seperable convolution, with DOUBLEMASK, no border
im_convsub - convolve uchar to uchar, sub-sampling by xskip, yskip
im_dmask_xsize - horizontal size of a doublemask
im_dmask_ysize - vertical size of a doublemask
im_embed - embed in within a set of borders
im_fastcor - fast correlate in2 within in1
im_fastcor_raw - fast correlate in2 within in1, no border
im_gauss_dmask - generate gaussian DOUBLEMASK
im_gauss_imask - generate gaussian INTMASK
im_gaussnoise - generate image of gaussian noise with specified statistics
im_gaussnoise - generate gaussian noise with specified statistics
im_grad_x - horizontal difference image
im_grad_y - vertical difference image
im_gradcor - unnormalised correlation of gradient
im_gradcor_raw - unnormalised correlation of gradient, no padding
im_gradient - convolve with 2-way rotating mask
im_imask_xsize - horizontal size of an intmask
im_imask_ysize - vertical size of an intmask
im_rank_image - point-wise pixel rank
im_lindetect - convolve with 4-way rotating mask
im_log_dmask - generate laplacian of gaussian DOUBLEMASK
im_log_imask - generate laplacian of gaussian INTMASK
im_maxvalue - point-wise maximum value
im_mpercent - find threshold above which there are percent values
im_phasecor_fft - non-normalised correlation of gradient of in2 within in1
im_rank - rank filter nth element of xsize/ysize window
im_rank_raw - rank filter nth element of xsize/ysize window, no border
im_read_dmask - read matrix of double from file
@ -514,11 +529,9 @@ im_rotate_imask90 - rotate INTMASK clockwise by 90 degrees
im_sharpen - sharpen high frequencies of L channel of LabQ
im_shrink - shrink image by xfac, yfac times
im_spcor - normalised correlation of in2 within in1
im_spcor_raw - normalised correlation of in2 within in1, no black padding
im_spcor2 - normalised correlation of in2 within in1
im_spcor2_raw - normalised correlation of in2 within in1, no black padding
im_spcor_raw - normalised correlation of in2 within in1, no padding
im_stretch3 - stretch 3%, sub-pixel displace by xdisp/ydisp
im_zerox - find +ve or -ve zero crossings in IM_BANDFMT_INT image
im_zerox - find +ve or -ve zero crossings in image
\end{verbatim}
\caption{Convolution functions}
\label{fg:convolution}
@ -530,7 +543,7 @@ im_zerox - find +ve or -ve zero crossings in IM_BANDFMT_INT image
See \fref{fg:inplace}.
A few of the in-place operations are available from the command-line. Most are
not. More will be added.
not.
\begin{fig2}
\begin{verbatim}
@ -748,6 +761,7 @@ images.
\begin{verbatim}
example% vips --list mosaicing
im_affine - affine transform
im_align_bands - align the bands of an image
im_correl - search area around sec for match for area around ref
im__find_lroverlap - search for left-right overlap of ref and sec
im__find_tboverlap - search for top-bottom overlap of ref and sec
@ -771,6 +785,23 @@ im_tbmosaic1 - first-order top-bottom mosaic of ref and sec
\label{fg:mosaicing}
\end{fig2}
\subsection{CImg functions}
See \fref{fg:cimg}.
These operations wrap the anisotropic blur function from the CImg library.
They are useful for removing noise from images.
\begin{fig2}
\begin{verbatim}
example% vips --list cimg
im_greyc - noise-removing filter
im_greyc_mask - noise-removing filter, with a mask
\end{verbatim}
\caption{CImg functions}
\label{fg:cimg}
\end{fig2}
\subsection{Other}
See \fref{fg:other}.
@ -800,7 +831,7 @@ im_zone - generate IM_BANDFMT_UCHAR [0,255] zone plate image
\subsection{IO functions}
See \fref{fg:other}.
See \fref{fg:io}.
These functions are related to the image IO system.

View File

@ -1,5 +1,5 @@
// this file automatically generated from
// VIPS library 7.13.1-Fri Oct 19 17:37:22 BST 2007
// VIPS library 7.14.0-Fri Feb 29 12:02:58 GMT 2008
VDMask estpar( VImage, int, int, int, double& ) throw( VError );
VImage transform( VDMask, int, int ) throw( VError );
VImage transform_search( VImage, double, int, int, int, int, VDMask&, double& ) throw( VError );
@ -14,6 +14,7 @@ VImage bandmean() throw( VError );
VImage ceil() throw( VError );
VImage cmulnorm( VImage ) throw( VError );
VImage cos() throw( VError );
VImage cross_phase( VImage ) throw( VError );
double deviate() throw( VError );
VImage divide( VImage ) throw( VError );
VImage exp10() throw( VError );
@ -170,6 +171,7 @@ void vips2mimejpeg( int ) throw( VError );
void vips2png( char* ) throw( VError );
void vips2ppm( char* ) throw( VError );
void vips2tiff( char* ) throw( VError );
VImage wrap( int, int ) throw( VError );
VImage zoom( int, int ) throw( VError );
VImage addgnoise( double ) throw( VError );
VImage compass( VIMask ) throw( VError );
@ -197,6 +199,7 @@ static VImage rank_image( std::vector<VImage>, int ) throw( VError );
VImage lindetect( VIMask ) throw( VError );
static VImage maxvalue( std::vector<VImage> ) throw( VError );
int mpercent( double ) throw( VError );
VImage phasecor_fft( VImage ) throw( VError );
VImage rank( int, int, int ) throw( VError );
VImage rank_raw( int, int, int ) throw( VError );
VImage resize_linear( int, int ) throw( VError );
@ -204,8 +207,6 @@ VImage sharpen( int, double, double, double, double, double ) throw( VError );
VImage shrink( double, double ) throw( VError );
VImage spcor( VImage ) throw( VError );
VImage spcor_raw( VImage ) throw( VError );
VImage spcor2( VImage ) throw( VError );
VImage spcor2_raw( VImage ) throw( VError );
VImage stretch3( double, double ) throw( VError );
VImage zerox( int ) throw( VError );
static VImage create_fmask( int, int, int, double, double, double, double, double ) throw( VError );
@ -261,6 +262,7 @@ VImage erode( VIMask ) throw( VError );
VImage erode_raw( VIMask ) throw( VError );
VImage profile( int ) throw( VError );
VImage affine( double, double, double, double, double, double, int, int, int, int ) throw( VError );
VImage align_bands() throw( VError );
double correl( VImage, int, int, int, int, int, int, int&, int& ) throw( VError );
int _find_lroverlap( VImage, int, int, int, int, int, int, int, int&, double&, double&, double&, double& ) throw( VError );
int _find_tboverlap( VImage, int, int, int, int, int, int, int, int&, double&, double&, double&, double& ) throw( VError );
@ -272,6 +274,7 @@ VImage lrmosaic( VImage, int, int, int, int, int, int, int, int, int ) throw( VE
VImage lrmosaic1( VImage, int, int, int, int, int, int, int, int, int, int, int, int, int ) throw( VError );
VImage match_linear( VImage, int, int, int, int, int, int, int, int ) throw( VError );
VImage match_linear_search( VImage, int, int, int, int, int, int, int, int, int, int ) throw( VError );
double maxpos_subpel( double& ) throw( VError );
VImage remosaic( char*, char* ) throw( VError );
VImage similarity_area( double, double, double, double, int, int, int, int ) throw( VError );
VImage similarity( double, double, double, double ) throw( VError );

View File

@ -1,5 +1,5 @@
// this file automatically generated from
// VIPS library 7.13.1-Fri Oct 19 17:37:22 BST 2007
// VIPS library 7.14.0-Fri Feb 29 12:02:58 GMT 2008
// im_estpar: estimate transform parms
VDMask VImage::estpar( VImage dst, int order, int ipol, int wrap, double& avg_displ ) throw( VError )
{
@ -244,6 +244,24 @@ VImage VImage::cos() throw( VError )
return( out );
}
// im_cross_phase: phase of cross power spectrum of two complex images
VImage VImage::cross_phase( VImage in2 ) throw( VError )
{
VImage in1 = *this;
VImage out;
Vargv _vec( "im_cross_phase" );
_vec.data(0) = in1.image();
_vec.data(1) = in2.image();
_vec.data(2) = out.image();
_vec.call();
out._ref->addref( in1._ref );
out._ref->addref( in2._ref );
return( out );
}
// im_deviate: standard deviation of image
double VImage::deviate() throw( VError )
{
@ -2890,6 +2908,24 @@ void VImage::vips2tiff( char* out ) throw( VError )
_vec.call();
}
// im_wrap: shift image origin, wrapping at sides
VImage VImage::wrap( int x, int y ) throw( VError )
{
VImage in = *this;
VImage out;
Vargv _vec( "im_wrap" );
_vec.data(0) = in.image();
_vec.data(1) = out.image();
*((int*) _vec.data(2)) = x;
*((int*) _vec.data(3)) = y;
_vec.call();
out._ref->addref( in._ref );
return( out );
}
// im_zoom: simple zoom of an image by integer factors
VImage VImage::zoom( int xfac, int yfac ) throw( VError )
{
@ -3206,7 +3242,7 @@ VImage VImage::gaussnoise( int xsize, int ysize, double mean, double sigma ) thr
return( out );
}
// im_grad_x: x component of gradient of image
// im_grad_x: horizontal difference image
VImage VImage::grad_x() throw( VError )
{
VImage in = *this;
@ -3222,7 +3258,7 @@ VImage VImage::grad_x() throw( VError )
return( out );
}
// im_grad_y: y component of gradient of image
// im_grad_y: vertical difference image
VImage VImage::grad_y() throw( VError )
{
VImage in = *this;
@ -3363,6 +3399,22 @@ int VImage::mpercent( double percent ) throw( VError )
return( thresh );
}
// im_phasecor_fft: non-normalised correlation of gradient of in2 within in1
VImage VImage::phasecor_fft( VImage in2 ) throw( VError )
{
VImage in1 = *this;
VImage out;
Vargv _vec( "im_phasecor_fft" );
_vec.data(0) = in1.image();
_vec.data(1) = in2.image();
_vec.data(2) = out.image();
_vec.call();
return( out );
}
// im_rank: rank filter nth element of xsize/ysize window
VImage VImage::rank( int xsize, int ysize, int n ) throw( VError )
{
@ -3494,42 +3546,6 @@ VImage VImage::spcor_raw( VImage in2 ) throw( VError )
return( out );
}
// im_spcor2: normalised correlation of in2 within in1
VImage VImage::spcor2( VImage in2 ) throw( VError )
{
VImage in1 = *this;
VImage out;
Vargv _vec( "im_spcor2" );
_vec.data(0) = in1.image();
_vec.data(1) = in2.image();
_vec.data(2) = out.image();
_vec.call();
out._ref->addref( in1._ref );
out._ref->addref( in2._ref );
return( out );
}
// im_spcor2_raw: normalised correlation of in2 within in1, no black padding
VImage VImage::spcor2_raw( VImage in2 ) throw( VError )
{
VImage in1 = *this;
VImage out;
Vargv _vec( "im_spcor2_raw" );
_vec.data(0) = in1.image();
_vec.data(1) = in2.image();
_vec.data(2) = out.image();
_vec.call();
out._ref->addref( in1._ref );
out._ref->addref( in2._ref );
return( out );
}
// im_stretch3: stretch 3%, sub-pixel displace by xdisp/ydisp
VImage VImage::stretch3( double xdisp, double ydisp ) throw( VError )
{
@ -4484,6 +4500,21 @@ VImage VImage::affine( double a, double b, double c, double d, double dx, double
return( out );
}
// im_align_bands: align the bands of an image
VImage VImage::align_bands() throw( VError )
{
VImage in = *this;
VImage out;
Vargv _vec( "im_align_bands" );
_vec.data(0) = in.image();
_vec.data(1) = out.image();
_vec.call();
return( out );
}
// im_correl: search area around sec for match for area around ref
double VImage::correl( VImage sec, int xref, int yref, int xsec, int ysec, int hwindowsize, int hsearchsize, int& x, int& y ) throw( VError )
{
@ -4758,6 +4789,22 @@ VImage VImage::match_linear_search( VImage sec, int xref1, int yref1, int xsec1,
return( out );
}
// im_maxpos_subpel: subpixel position of maximum of (phase correlation) image
double VImage::maxpos_subpel( double& y ) throw( VError )
{
VImage im = *this;
double x;
Vargv _vec( "im_maxpos_subpel" );
_vec.data(0) = im.image();
_vec.call();
x = *((double*)_vec.data(1));
y = *((double*)_vec.data(2));
return( x );
}
// im_remosaic: automatically rebuild mosaic with new files
VImage VImage::remosaic( char* old_str, char* new_str ) throw( VError )
{

View File

@ -29,6 +29,8 @@
* - use GOption, loop over args
* 4/1/07
* - use im_history_get()
* 29/2/08
* - don't stop on error
*/
/*
@ -78,6 +80,20 @@ static GOptionEntry main_option[] = {
{ NULL }
};
/* A non-fatal error. Print the vips error buffer and continue.
*/
static void
print_error( const char *fmt, ... )
{
va_list ap;
va_start( ap, fmt );
vfprintf( stderr, fmt, ap );
va_end( ap );
fprintf( stderr, "\n%s\n", im_error_buffer() );
im_error_clear();
}
/* Print header, or parts of header.
*/
static int
@ -163,11 +179,13 @@ main( int argc, char *argv[] )
IMAGE *im;
if( !(im = im_open( argv[i], "r" )) )
error_exit( "unable to open %s", argv[i] );
if( print_header( im ) )
error_exit( _( "unable to print header of \"%s\"" ),
argv[i] );
im_close( im );
print_error( "%s: unable to open", argv[i] );
if( im && print_header( im ) )
print_error( "%s: unable to print header", argv[i] );
if( im )
im_close( im );
}
return( 0 );