other

other — miscellaneous operators

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <vips/vips.h>

int                 im_grey                             (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize);
int                 im_fgrey                            (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize);
int                 im_make_xy                          (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize);
int                 im_feye                             (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize,
                                                         const double factor);
int                 im_eye                              (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize,
                                                         const double factor);
int                 im_zone                             (VipsImage *out,
                                                         int size);
int                 im_fzone                            (VipsImage *out,
                                                         int size);
int                 im_sines                            (VipsImage *out,
                                                         int xsize,
                                                         int ysize,
                                                         double horfreq,
                                                         double verfreq);
int                 im_benchmarkn                       (VipsImage *in,
                                                         VipsImage *out,
                                                         int n);
int                 im_benchmark2                       (VipsImage *in,
                                                         double *out);

Description

These functions generate various test images. You can combine them with the arithmetic and rotate functions to build more complicated images.

The im_benchmark() operations are for testing the VIPS SMP system.

Details

im_grey ()

int                 im_grey                             (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize);

Create a one-band uchar image with the left-most column zero and the right-most 255. Intermediate pixels are a linear ramp.

See also: im_fgrey(), im_make_xy(), im_identity().

out :

output image

xsize :

image size

ysize :

image size

Returns :

0 on success, -1 on error

im_fgrey ()

int                 im_fgrey                            (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize);

Create a one-band float image with the left-most column zero and the right-most 1. Intermediate pixels are a linear ramp.

See also: im_grey(), im_make_xy(), im_identity().

out :

output image

xsize :

image size

ysize :

image size

Returns :

0 on success, -1 on error

im_make_xy ()

int                 im_make_xy                          (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize);

Create a two-band uint32 image where the elements in the first band have the value of their x coordinate and elements in the second band have their y coordinate.

You can make any image where the value of a pixel is a function of its (x, y) coordinate by combining this operator with the arithmetic operators.

See also: im_grey(), im_identity().

out :

output image

xsize :

image size

ysize :

image size

Returns :

0 on success, -1 on error

im_feye ()

int                 im_feye                             (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize,
                                                         const double factor);

Create a test pattern with increasing spatial frequence in X and amplitude in Y. factor should be between 0 and 1 and determines the maximum spatial frequency.

Creates an one band float image with values in +1 to -1.

See also: im_eye().

out :

output image

xsize :

image size

ysize :

image size

factor :

image size

Returns :

0 on success, -1 on error

im_eye ()

int                 im_eye                              (VipsImage *out,
                                                         const int xsize,
                                                         const int ysize,
                                                         const double factor);

Exactly as im_feye(), but make a UCHAR image with pixels in the range [0, 255].

See also: im_feye().

out :

output image

xsize :

image size

ysize :

image size

factor :

image size

Returns :

0 on success, -1 on error

im_zone ()

int                 im_zone                             (VipsImage *out,
                                                         int size);

Create a one-band uchar image of size size by size pixels of a zone plate. Pixels are in [0, 255].

See also: im_grey(), im_make_xy(), im_identity().

out :

output image

size :

image size

Returns :

0 on success, -1 on error

im_fzone ()

int                 im_fzone                            (VipsImage *out,
                                                         int size);

Create a one-band float image of size size by size pixels of a zone plate. Pixels are in [-1, +1].

See also: im_grey(), im_make_xy(), im_identity().

out :

output image

size :

image size

Returns :

0 on success, -1 on error

im_sines ()

int                 im_sines                            (VipsImage *out,
                                                         int xsize,
                                                         int ysize,
                                                         double horfreq,
                                                         double verfreq);

im_sines() creates a float one band image of the a sine waveform in two dimensions.

The number of horizontal and vertical spatial frequencies are determined by the variables horfreq and verfreq respectively. The function is useful for creating displayable sine waves and square waves in two dimensions.

If horfreq and verfreq are integers the resultant image is periodical and therfore the Fourier transform doesnot present spikes

See also: im_grey(), im_make_xy().

out :

output image

xsize :

image size

ysize :

image size

horfreq :

horizontal frequency

verfreq :

vertical frequency

Returns :

0 on success, -1 on error

im_benchmarkn ()

int                 im_benchmarkn                       (VipsImage *in,
                                                         VipsImage *out,
                                                         int n);

This operation runs a complicated set of other operations on image in, producing image out. Use n to set the number of iterations to run: a larger number will make the operation more CPU-bound, a smaller number will make the operation more IO-bound.

See http://www.vips.ecs.soton.ac.uk/index.php?title=Benchmarks for a detailed discussion of the benchmark and some sample results.

See also: im_benchmark2().

in :

input image

out :

output image

n :

iterations

Returns :

0 on success, -1 on error

im_benchmark2 ()

int                 im_benchmark2                       (VipsImage *in,
                                                         double *out);

This operation runs a single im_benchmarkn() and calculates the average pixel value. It's useful if you just want to test image input.

See also: im_benchmarkn().

in :

input image

out :

average image value

Returns :

0 on success, -1 on error