Movatterモバイル変換


[0]ホーム

URL:


libvips

A fast image processing library with low memory needs.

DownloadInstallDocumentationIssuesWikilibvips projectslibvips on GitHub
Top  | Description  | Object HierarchyHomeUpPrevNext

arithmetic

arithmetic — pixel arithmetic, trig, log, statistics

Stability Level

Stable, unless otherwise indicated

Functions

intvips_add ()
intvips_sum ()
intvips_subtract ()
intvips_multiply ()
intvips_divide ()
intvips_linear ()
intvips_linear1 ()
intvips_remainder ()
intvips_remainder_const ()
intvips_remainder_const1 ()
intvips_invert ()
intvips_abs ()
intvips_sign ()
intvips_clamp ()
intvips_maxpair ()
intvips_minpair ()
intvips_round ()
intvips_floor ()
intvips_ceil ()
intvips_rint ()
intvips_math ()
intvips_sin ()
intvips_cos ()
intvips_tan ()
intvips_asin ()
intvips_acos ()
intvips_atan ()
intvips_exp ()
intvips_exp10 ()
intvips_log ()
intvips_log10 ()
intvips_sinh ()
intvips_cosh ()
intvips_tanh ()
intvips_asinh ()
intvips_acosh ()
intvips_atanh ()
intvips_complex ()
intvips_polar ()
intvips_rect ()
intvips_conj ()
intvips_complex2 ()
intvips_cross_phase ()
intvips_complexget ()
intvips_real ()
intvips_imag ()
intvips_complexform ()
intvips_relational ()
intvips_equal ()
intvips_notequal ()
intvips_less ()
intvips_lesseq ()
intvips_more ()
intvips_moreeq ()
intvips_relational_const ()
intvips_equal_const ()
intvips_notequal_const ()
intvips_less_const ()
intvips_lesseq_const ()
intvips_more_const ()
intvips_moreeq_const ()
intvips_relational_const1 ()
intvips_equal_const1 ()
intvips_notequal_const1 ()
intvips_less_const1 ()
intvips_lesseq_const1 ()
intvips_more_const1 ()
intvips_moreeq_const1 ()
intvips_boolean ()
intvips_andimage ()
intvips_orimage ()
intvips_eorimage ()
intvips_lshift ()
intvips_rshift ()
intvips_boolean_const ()
intvips_andimage_const ()
intvips_orimage_const ()
intvips_eorimage_const ()
intvips_lshift_const ()
intvips_rshift_const ()
intvips_boolean_const1 ()
intvips_andimage_const1 ()
intvips_orimage_const1 ()
intvips_eorimage_const1 ()
intvips_lshift_const1 ()
intvips_rshift_const1 ()
intvips_math2 ()
intvips_pow ()
intvips_wop ()
intvips_atan2 ()
intvips_math2_const ()
intvips_pow_const ()
intvips_wop_const ()
intvips_atan2_const ()
intvips_math2_const1 ()
intvips_pow_const1 ()
intvips_wop_const1 ()
intvips_atan2_const1 ()
intvips_avg ()
intvips_deviate ()
intvips_min ()
intvips_max ()
intvips_stats ()
intvips_measure ()
intvips_find_trim ()
intvips_getpoint ()
intvips_hist_find ()
intvips_hist_find_ndim ()
intvips_hist_find_indexed ()
intvips_hough_line ()
intvips_hough_circle ()
intvips_project ()
intvips_profile ()

Types and Values

enumVipsOperationMath
enumVipsOperationMath2
enumVipsOperationRound
enumVipsOperationRelational
enumVipsOperationBoolean
enumVipsOperationComplex
enumVipsOperationComplex2
enumVipsOperationComplexget

Object Hierarchy

GEnum├── VipsOperationBoolean├── VipsOperationComplex├── VipsOperationComplex2├── VipsOperationComplexget├── VipsOperationMath├── VipsOperationMath2├── VipsOperationRelational╰── VipsOperationRound

Includes

#include <vips/vips.h>

Description

These operations perform pixel arithmetic, that is, they perform anarithmetic operation, such as addition, on every pixel in an image or apair of images. All (except in a few cases noted below) will work withimages of any type or any mixture of types, of any size and of any numberof bands.

For binary operations, if the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

In the same way, for operations that take an array constant, such asvips_remainder_const(), you can mix single-element arrays or single-bandimages freely.

Arithmetic operations try to preserve precision by increasing the number ofbits in the output image when necessary. Generally, this follows the ANSI Cconventions for type promotion, so multiplying twoVIPS_FORMAT_UCHAR images together, for example, produces aVIPS_FORMAT_USHORT image, and taking thevips_cos() of aVIPS_FORMAT_USHORT image producesVIPS_FORMAT_FLOAT image.

After processing, usevips_cast() and friends to take then format back downagain.vips_cast_uchar(), for example, will cast any image down to 8-bitunsigned.

Images have an *interpretation*: a meaning for the pixel values. WithVIPS_INTERPRETATION_sRGB, for example, the first three bands will beinterpreted (for example, by a saver likevips_jpegsave()) as R, G and B,with values in 0 - 255, and any fourth band will be interpreted as analpha channel.

After arithmetic, you may wish to change the interpretation (for example tosave as 16-bit PNG). Usevips_copy() to change the interpretation withoutchanging pixels.

For binary arithmetic operations, type promotion occurs in two stages.First, the two input images are cast up to the smallest common format,that is, the type with the smallest range that can represent the fullrange of both inputs. This conversion can be represented as a table:

Table 3. Smallest common format

in2/in1ucharcharushortshortuintintfloatdoublecomplexdouble complex
ucharushortshortushortshortuintintfloatdoublecomplexdouble complex
charshortshortshortshortintintfloatdoublecomplexdouble complex
ushortushortshortushortshortuintintfloatdoublecomplexdouble complex
shortshortshortshortshortintintfloatdoublecomplexdouble complex
uintuintintuintintuintintfloatdoublecomplexdouble complex
intintintintintintintfloatdoublecomplexdouble complex
floatfloatfloatfloatfloatfloatfloatfloatdoublecomplexdouble complex
doubledoubledoubledoubledoubledoubledoubledoubledoubledouble complexdouble complex
complexcomplexcomplexcomplexcomplexcomplexcomplexcomplexdouble complexcomplexdouble complex
double complexdouble complexdouble complexdouble complexdouble complexdouble complexdouble complexdouble complexdouble complexdouble complexdouble complex

In the second stage, the operation is performed between the two identicaltypes to form the output. The details vary between operations, butgenerally the principle is that the output type should be large enough torepresent the whole range of possible values, except that int never becomesfloat.

Functions

vips_add ()

intvips_add (VipsImage *left,VipsImage *right,VipsImage **out,...);

This operation calculatesin1 +in2 and writes the result toout.

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), then the

following table is used to determine the output type:

Table 4. VipsAdd type promotion

input typeoutput type
ucharushort
charshort
ushortuint
shortint
uintuint
intint
floatfloat
doubledouble
complexcomplex
double complexdouble complex

In other words, the output type is just large enough to hold the wholerange of possible values.

See also:vips_subtract(),vips_linear().

Parameters

left

input image

 

right

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_sum ()

intvips_sum (VipsImage **in,VipsImage **out,int n,...);

This operation sums all images inin and writes the result toout.

If the images differ in size, the smaller images are enlarged to match thelargest by adding zero pixels along the bottom and right.

If the number of bands differs, all but one of the imagesmust have one band. In this case, n-band images are formed from theone-band images by joining n copies of the one-band images together, and thenthe n-band images are operated upon.

The input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), then the

following table is used to determine the output type:

Table 5. VipsSum type promotion

input typeoutput type
ucharuint
charint
ushortuint
shortint
uintuint
intint
floatfloat
doubledouble
complexcomplex
double complexdouble complex

In other words, the output type is just large enough to hold the wholerange of possible values.

See also:vips_add().

Parameters

in

array of input images.

[array length=n]

out

output image.

[out]

n

number of input images

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_subtract ()

intvips_subtract (VipsImage *in1,VipsImage *in2,VipsImage **out,...);

This operation calculatesin1 -in2 and writes the result toout.

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), then the

following table is used to determine the output type:

Table 6. VipsSubtract type promotion

input typeoutput type
ucharshort
charshort
ushortint
shortint
uintint
intint
floatfloat
doubledouble
complexcomplex
double complexdouble complex

In other words, the output type is just large enough to hold the wholerange of possible values.

See also:vips_add(),vips_linear().

Parameters

in1

input image

 

in2

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_multiply ()

intvips_multiply (VipsImage *left,VipsImage *right,VipsImage **out,...);

This operation calculatesleft *right and writes the result toout.

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), then the

following table is used to determine the output type:

Table 7. VipsMultiply type promotion

input typeoutput type
ucharushort
charshort
ushortuint
shortint
uintuint
intint
floatfloat
doubledouble
complexcomplex
double complexdouble complex

In other words, the output type is just large enough to hold the wholerange of possible values.

See also:vips_add(),vips_linear().

Parameters

left

left-hand image

 

right

right-hand image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_divide ()

intvips_divide (VipsImage *left,VipsImage *right,VipsImage **out,...);

This operation calculatesin1 /in2 and writes the result toout. If anypixels inin2 are zero, the corresponding pixel inout is also zero.

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), then the

following table is used to determine the output type:

Table 8. vips_divide() type promotion

input typeoutput type
ucharfloat
charfloat
ushortfloat
shortfloat
uintfloat
intfloat
floatfloat
doubledouble
complexcomplex
double complexdouble complex

In other words, the output type is just large enough to hold the wholerange of possible values.

See also:vips_multiply(),vips_linear(),vips_pow().

Parameters

left

input image

 

right

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_linear ()

intvips_linear (VipsImage *in,VipsImage **out,constdouble *a,constdouble *b,int n,...);

Optional arguments:

  • uchar: output uchar pixels

Pass an image through a linear transform, ie. (out =in *a +b). Outputis float for integer input, double for double input, complex forcomplex input and double complex for double complex input. Setuchar tooutput uchar pixels.

If the arrays of constants have just one element, that constant is used forall image bands. If the arrays have more than one element and they havethe same number of elements as there are bands in the image, thenone array element is used for each band. If the arrays have more than oneelement and the image only has a single band, the result is a many-bandimage where each band corresponds to one array element.

See also:vips_linear1(),vips_add().

[method]

Parameters

in

image to transform

 

out

output image.

[out]

a

array of constants for multiplication.

[array length=n]

b

array of constants for addition.

[array length=n]

n

length of constant arrays

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_linear1 ()

intvips_linear1 (VipsImage *in,VipsImage **out,double a,double b,...);

Optional arguments:

  • uchar: output uchar pixels

Runvips_linear() with a single constant.

See also:vips_linear().

[method]

Parameters

in

image to transform

 

out

output image.

[out]

a

constant for multiplication

 

b

constant for addition

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_remainder ()

intvips_remainder (VipsImage *left,VipsImage *right,VipsImage **out,...);

This operation calculatesleft %right (remainder after integer division)and writes the result toout. The images may have anynon-complex format. For float formats,vips_remainder() calculatesin1 -in2 * floor (in1 /in2).

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), and that format is the

result type.

See also:vips_remainder_const(),vips_divide(),vips_round().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_remainder_const ()

intvips_remainder_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

This operation calculatesin %c (remainder after division by anarray of constants)and writes the result toout.The image may have anynon-complex format. For float formats,vips_remainder_const() calculatesin -c * floor (in /c).

If the array of constants has just one element, that constant is used forall image bands. If the array has more than one element and they havethe same number of elements as there are bands in the image, thenone array element is used for each band. If the arrays have more than oneelement and the image only has a single band, the result is a many-bandimage where each band corresponds to one array element.

See also:vips_remainder(),vips_divide(),vips_round().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_remainder_const1 ()

intvips_remainder_const1 (VipsImage *in,VipsImage **out,double c,...);

This operation calculatesin %c (remainder after division by aconstant)and writes the result toout.The image may have anynon-complex format. For float formats,vips_remainder_const() calculatesin -c * floor (in /c).

If the array of constants has just one element, that constant is used forall image bands. If the array has more than one element and they havethe same number of elements as there are bands in the image, thenone array element is used for each band. If the arrays have more than oneelement and the image only has a single band, the result is a many-bandimage where each band corresponds to one array element.

See also:vips_remainder(),vips_divide(),vips_round().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_invert ()

intvips_invert (VipsImage *in,VipsImage **out,...);

For unsigned formats, this operation calculates (max -in), eg. (255 -in) for uchar. For signed and float formats, this operation calculates (-1in).

For complex images, only the real part is inverted. See alsovips_conj().

See also:vips_linear().

[method]

Parameters

in

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_abs ()

intvips_abs (VipsImage *in,VipsImage **out,...);

This operation finds the absolute value of an image. It does a copy forunsigned integer types, negate for negative values insigned integer types,fabs(3) forfloat types, and calculates modulus for complextypes.

See also:vips_sign().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_sign ()

intvips_sign (VipsImage *in,VipsImage **out,...);

Finds the unit vector in the direction of the pixel value. For non-compleximages, it returns a signed char image with values -1, 0, and 1 for negative,zero and positive pixels. For complex images, it returns acomplex normalised to length 1.

See also:vips_abs().

[method]

Parameters

in

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_clamp ()

intvips_clamp (VipsImage *in,VipsImage **out,...);

Optional arguments:

  • min:gdouble, minimum value

  • max:gdouble, maximum value

This operation clamps pixel values to a range, by default 0 - 1.

Usemin andmax to change the range.

See also:vips_sign(),vips_abs(),vips_sdf().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_maxpair ()

intvips_maxpair (VipsImage *left,VipsImage *right,VipsImage **out,...);

For each pixel, pick the maximum of a pair of images.

See also:vips_minpair().

Parameters

left

input image

 

right

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_minpair ()

intvips_minpair (VipsImage *left,VipsImage *right,VipsImage **out,...);

For each pixel, pick the minimum of a pair of images.

See also:vips_minpair().

Parameters

left

input image

 

right

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_round ()

intvips_round (VipsImage *in,VipsImage **out,VipsOperationRound round,...);

Round to an integral value.

Copy for integer types, round float andcomplex types.

The format ofout is always the same asin, so you may wish to cast to aninteger format afterwards.

See also:vips_cast()

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

round

VipsOperationRound rounding operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_floor ()

intvips_floor (VipsImage *in,VipsImage **out,...);

Round to an integral value withVIPS_OPERATION_ROUND_FLOOR. Seevips_round().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_ceil ()

intvips_ceil (VipsImage *in,VipsImage **out,...);

Round to an integral value withVIPS_OPERATION_ROUND_CEIL. Seevips_round().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_rint ()

intvips_rint (VipsImage *in,VipsImage **out,...);

Round to an integral value withVIPS_OPERATION_ROUND_RINT. Seevips_round().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_math ()

intvips_math (VipsImage *in,VipsImage **out,VipsOperationMath math,...);

Perform various functions in -lm, the maths library, on images.

Angles are expressed in degrees. The output type is float unless theinput is double, in which case the output is double.

Non-complex images only.

See also:vips_math2().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

math

math operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_sin ()

intvips_sin (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_SIN on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_cos ()

intvips_cos (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_COS on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_tan ()

intvips_tan (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_TAN on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_asin ()

intvips_asin (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_ASIN on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_acos ()

intvips_acos (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_ACOS on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_atan ()

intvips_atan (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_ATAN on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_exp ()

intvips_exp (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_EXP on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_exp10 ()

intvips_exp10 (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_EXP10 on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_log ()

intvips_log (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_LOG on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_log10 ()

intvips_log10 (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_LOG10 on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_sinh ()

intvips_sinh (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_SINH on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_cosh ()

intvips_cosh (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_COSH on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_tanh ()

intvips_tanh (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_TANH on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_asinh ()

intvips_asinh (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_ASINH on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_acosh ()

intvips_acosh (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_ACOSH on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_atanh ()

intvips_atanh (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_MATH_ATANH on an image. Seevips_math().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_complex ()

intvips_complex (VipsImage *in,VipsImage **out,VipsOperationComplex cmplx,...);

Perform various operations on complex images.

Angles are expressed in degrees. The output type is complex unless theinput is double or dpcomplex, in which case the output is dpcomplex.

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

cmplx

complex operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_polar ()

intvips_polar (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_COMPLEX_POLAR on an image. Seevips_complex().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_rect ()

intvips_rect (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_COMPLEX_RECT on an image. Seevips_complex().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_conj ()

intvips_conj (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_COMPLEX_CONJ on an image. Seevips_complex().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_complex2 ()

intvips_complex2 (VipsImage *left,VipsImage *right,VipsImage **out,VipsOperationComplex2 cmplx,...);

Perform various binary operations on complex images.

Angles are expressed in degrees. The output type is complex unless theinput is double or dpcomplex, in which case the output is dpcomplex.

Parameters

left

inputVipsImage

 

right

inputVipsImage

 

out

outputVipsImage.

[out]

cmplx

complex2 operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_cross_phase ()

intvips_cross_phase (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_COMPLEX2_CROSS_PHASE on an image.Seevips_complex2().

Parameters

left

inputVipsImage

 

right

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_complexget ()

intvips_complexget (VipsImage *in,VipsImage **out,VipsOperationComplexget get,...);

Get components of complex images.

The output type is the same as the input type, exceptVIPS_FORMAT_COMPLEXbecomesVIPS_FORMAT_FLOAT andVIPS_FORMAT_DPCOMPLEX becomesVIPS_FORMAT_DOUBLE.

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

get

complex operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_real ()

intvips_real (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_COMPLEXGET_REAL on an image. Seevips_complexget().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_imag ()

intvips_imag (VipsImage *in,VipsImage **out,...);

PerformVIPS_OPERATION_COMPLEXGET_IMAG on an image. Seevips_complexget().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_complexform ()

intvips_complexform (VipsImage *left,VipsImage *right,VipsImage **out,...);

Compose two real images to make a complex image. If eitherleft orrightareVIPS_FORMAT_DOUBLE,out isVIPS_FORMAT_DPCOMPLEX. OtherwiseoutisVIPS_FORMAT_COMPLEX.left becomes the real component ofout andright the imaginary.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

See also:vips_complexget().

Parameters

left

input image

 

right

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_relational ()

intvips_relational (VipsImage *left,VipsImage *right,VipsImage **out,VipsOperationRelational relational,...);

Perform various relational operations on pairs of images.

The output type is always uchar, with 0 for FALSE and 255 for TRUE.

Less-than and greater-than for complex images compare the modulus.

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic).

To decide if pixels match exactly, that is have the same value in everyband, usevips_bandbool() after this operation to AND or OR image bandstogether.

See also:vips_boolean(),vips_bandbool(),vips_relational_const().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

relational

relational operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_equal ()

intvips_equal (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_RELATIONAL_EQUAL on a pair of images. Seevips_relational().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_notequal ()

intvips_notequal (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_RELATIONAL_NOTEQ on a pair of images. Seevips_relational().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_less ()

intvips_less (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_RELATIONAL_LESS on a pair of images. Seevips_relational().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_lesseq ()

intvips_lesseq (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_RELATIONAL_LESSEQ on a pair of images. Seevips_relational().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_more ()

intvips_more (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_RELATIONAL_MORE on a pair of images. Seevips_relational().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_moreeq ()

intvips_moreeq (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_RELATIONAL_MOREEQ on a pair of images. Seevips_relational().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_relational_const ()

intvips_relational_const (VipsImage *in,VipsImage **out,VipsOperationRelational relational,constdouble *c,int n,...);

Perform various relational operations on an image and an array ofconstants.

The output type is always uchar, with 0 for FALSE and 255 for TRUE.

If the array of constants has just one element, that constant is used forall image bands. If the array has more than one element and they havethe same number of elements as there are bands in the image, thenone array element is used for each band. If the arrays have more than oneelement and the image only has a single band, the result is a many-bandimage where each band corresponds to one array element.

See also:vips_boolean(),vips_relational().

[method]

Parameters

in

input image

 

out

output image.

[out]

relational

relational operation to perform

 

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_equal_const ()

intvips_equal_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_notequal_const ()

intvips_notequal_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_RELATIONAL_NOTEQ on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_less_const ()

intvips_less_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_RELATIONAL_LESS on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_lesseq_const ()

intvips_lesseq_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_more_const ()

intvips_more_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_RELATIONAL_MORE on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_moreeq_const ()

intvips_moreeq_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_relational_const1 ()

intvips_relational_const1 (VipsImage *in,VipsImage **out,VipsOperationRelational relational,double c,...);

Perform various relational operations on an image and a constant. Seevips_relational_const().

See also:vips_boolean(),vips_relational().

[method]

Parameters

in

input image

 

out

output image.

[out]

relational

relational operation to perform

 

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_equal_const1 ()

intvips_equal_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_notequal_const1 ()

intvips_notequal_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_RELATIONAL_NOTEQ on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_less_const1 ()

intvips_less_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_RELATIONAL_LESS on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_lesseq_const1 ()

intvips_lesseq_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_more_const1 ()

intvips_more_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_RELATIONAL_MORE on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_moreeq_const1 ()

intvips_moreeq_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. Seevips_relational_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_boolean ()

intvips_boolean (VipsImage *left,VipsImage *right,VipsImage **out,VipsOperationBoolean boolean,...);

Perform various boolean operations on pairs of images.

The output image is the same format as the upcast input images for integertypes. Float types are cast to int before processing. Complex types are notsupported.

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic).

See also:vips_boolean_const().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

boolean

boolean operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_andimage ()

intvips_andimage (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_BOOLEAN_AND on a pair of images. Seevips_boolean().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_orimage ()

intvips_orimage (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_BOOLEAN_OR on a pair of images. Seevips_boolean().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_eorimage ()

intvips_eorimage (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_BOOLEAN_EOR on a pair of images. Seevips_boolean().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_lshift ()

intvips_lshift (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_BOOLEAN_LSHIFT on a pair of images. Seevips_boolean().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_rshift ()

intvips_rshift (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_BOOLEAN_RSHIFT on a pair of images. Seevips_boolean().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_boolean_const ()

intvips_boolean_const (VipsImage *in,VipsImage **out,VipsOperationBoolean boolean,constdouble *c,int n,...);

Perform various boolean operations on an image against an array ofconstants.

The output type is always uchar, with 0 for FALSE and 255 for TRUE.

If the array of constants has just one element, that constant is used forall image bands. If the array has more than one element and they havethe same number of elements as there are bands in the image, thenone array element is used for each band. If the arrays have more than oneelement and the image only has a single band, the result is a many-bandimage where each band corresponds to one array element.

See also:vips_boolean(),vips_boolean_const1().

[method]

Parameters

in

input image

 

out

output image.

[out]

boolean

boolean operation to perform

 

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_andimage_const ()

intvips_andimage_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_BOOLEAN_AND on an image and an array of constants.Seevips_boolean_const().

See also:vips_boolean(),vips_boolean_const1().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_orimage_const ()

intvips_orimage_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_BOOLEAN_OR on an image and an array of constants.Seevips_boolean_const().

See also:vips_boolean(),vips_boolean_const1().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_eorimage_const ()

intvips_eorimage_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_BOOLEAN_EOR on an image and an array of constants.Seevips_boolean_const().

See also:vips_boolean(),vips_boolean_const1().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_lshift_const ()

intvips_lshift_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_BOOLEAN_LSHIFT on an image and an array of constants.Seevips_boolean_const().

See also:vips_boolean(),vips_boolean_const1().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_rshift_const ()

intvips_rshift_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_BOOLEAN_LSHIFT on an image and an array of constants.Seevips_boolean_const().

See also:vips_boolean(),vips_boolean_const1().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_boolean_const1 ()

intvips_boolean_const1 (VipsImage *in,VipsImage **out,VipsOperationBoolean boolean,double c,...);

Perform various boolean operations on an image with a single constant. Seevips_boolean_const().

See also:vips_boolean(),vips_boolean_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

boolean

boolean operation to perform

 

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_andimage_const1 ()

intvips_andimage_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_BOOLEAN_AND on an image and a constant.Seevips_boolean_const1().

See also:vips_boolean(),vips_boolean_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_orimage_const1 ()

intvips_orimage_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_BOOLEAN_OR on an image and a constant.Seevips_boolean_const1().

See also:vips_boolean(),vips_boolean_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_eorimage_const1 ()

intvips_eorimage_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_BOOLEAN_EOR on an image and a constant.Seevips_boolean_const1().

See also:vips_boolean(),vips_boolean_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_lshift_const1 ()

intvips_lshift_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_BOOLEAN_LSHIFT on an image and a constant.Seevips_boolean_const1().

See also:vips_boolean(),vips_boolean_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_rshift_const1 ()

intvips_rshift_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_BOOLEAN_RSHIFT on an image and a constant.Seevips_boolean_const1().

See also:vips_boolean(),vips_boolean_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_math2 ()

intvips_math2 (VipsImage *left,VipsImage *right,VipsImage **out,VipsOperationMath2 math2,...);

This operation calculates a 2-ary maths operation on a pair of imagesand writes the result toout. The images may have anynon-complex format.out is float except in the case that either ofleftorright are double, in which caseout is also double.

It detects division by zero, setting those pixels to zero in the output.Beware: it does this silently!

If the images differ in size, the smaller image is enlarged to match thelarger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the imagesmust have one band. In this case, an n-band image is formed from theone-band image by joining n copies of the one-band image together, and thenthe two n-band images are operated upon.

The two input images are cast up to the smallest common format (see tableSmallest common format in

arithmetic), and that format is the

result type.

See also:vips_math2_const().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

math2

math operation to perform

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_pow ()

intvips_pow (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_MATH2_POW on a pair of images. Seevips_math2().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_wop ()

intvips_wop (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_MATH2_WOP on a pair of images. Seevips_math2().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_atan2 ()

intvips_atan2 (VipsImage *left,VipsImage *right,VipsImage **out,...);

PerformVIPS_OPERATION_MATH2_ATAN2 on a pair of images. Seevips_math2().

Parameters

left

left-hand inputVipsImage

 

right

right-hand inputVipsImage

 

out

outputVipsImage.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_math2_const ()

intvips_math2_const (VipsImage *in,VipsImage **out,VipsOperationMath2 math2,constdouble *c,int n,...);

This operation calculates various 2-ary maths operations on an image andan array of constants and writes the result toout.The image may have anynon-complex format.out is float except in the case thatinis double, in which caseout is also double.

It detects division by zero, setting those pixels to zero in the output.Beware: it does this silently!

If the array of constants has just one element, that constant is used forall image bands. If the array has more than one element and they havethe same number of elements as there are bands in the image, thenone array element is used for each band. If the arrays have more than oneelement and the image only has a single band, the result is a many-bandimage where each band corresponds to one array element.

See also:vips_math2(),vips_math().

[method]

Parameters

in

input image

 

out

output image.

[out]

math2

math operation to perform

 

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_pow_const ()

intvips_pow_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_MATH2_POW on an image and a constant. Seevips_math2_const().

[method]

Parameters

in

left-hand inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_wop_const ()

intvips_wop_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_MATH2_WOP on an image and a constant. Seevips_math2_const().

[method]

Parameters

in

left-hand inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_atan2_const ()

intvips_atan2_const (VipsImage *in,VipsImage **out,constdouble *c,int n,...);

PerformVIPS_OPERATION_MATH2_ATAN2 on an image and a constant. Seevips_math2_const().

[method]

Parameters

in

left-hand inputVipsImage

 

out

outputVipsImage.

[out]

c

array of constants.

[array length=n]

n

number of constants inc

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_math2_const1 ()

intvips_math2_const1 (VipsImage *in,VipsImage **out,VipsOperationMath2 math2,double c,...);

This operation calculates various 2-ary maths operations on an image anda constant. Seevips_math2_const().

[method]

Parameters

in

input image

 

out

output image.

[out]

math2

math operation to perform

 

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_pow_const1 ()

intvips_pow_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_MATH2_POW on an image and a constant. Seevips_math2_const().

[method]

Parameters

in

left-hand inputVipsImage

 

out

outputVipsImage.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_wop_const1 ()

intvips_wop_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_MATH2_WOP on an image and a constant. Seevips_math2_const().

[method]

Parameters

in

left-hand inputVipsImage

 

out

outputVipsImage.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_atan2_const1 ()

intvips_atan2_const1 (VipsImage *in,VipsImage **out,double c,...);

PerformVIPS_OPERATION_MATH2_ATAN2 on an image and a constant. Seevips_math2_const().

[method]

Parameters

in

left-hand inputVipsImage

 

out

outputVipsImage.

[out]

c

constant

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_avg ()

intvips_avg (VipsImage *in,double *out,...);

This operation finds the average value in an image. It operates on allbands of the input image: usevips_stats() if you need to calculate anaverage for each band. For complex images, return the average modulus.

See also:vips_stats(),vips_bandmean(),vips_deviate(),vips_rank()

[method]

Parameters

in

inputVipsImage

 

out

output pixel average.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_deviate ()

intvips_deviate (VipsImage *in,double *out,...);

This operation finds the standard deviation of all pixels inin. Itoperates on all bands of the input image: usevips_stats() if you needto calculate an average for each band.

Non-complex images only.

See also:vips_avg(),vips_stats()..

[method]

Parameters

in

inputVipsImage

 

out

output pixel standard deviation.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_min ()

intvips_min (VipsImage *in,double *out,...);

Optional arguments:

  • x: horizontal position of minimum

  • y: vertical position of minimum

  • size: number of minima to find

  • out_array: return array of minimum values

  • x_array: corresponding horizontal positions

  • y_array: corresponding vertical positions

This operation finds the minimum value in an image.

By default it finds the single smallest value. Ifsize is set >1, it willfind thesize smallest values. It will stop searching early if has foundenough values.Equal values will be sorted by y then x.

It operates on allbands of the input image: usevips_stats() if you need to find anminimum for each band.

For complex images, this operation finds the minimum modulus.

You can read out the position of the minimum withx andy. You can readout arrays of the values and positions of the topsize minima without_array,x_array andy_array.These values are returned sorted fromsmallest to largest.

If there are more thansize minima, the minima returned will be a randomselection of the minima in the image.

See also:vips_min(),vips_stats().

[method]

Parameters

in

inputVipsImage

 

out

output pixel minimum.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_max ()

intvips_max (VipsImage *in,double *out,...);

Optional arguments:

  • x: horizontal position of maximum

  • y: vertical position of maximum

  • size: number of maxima to find

  • out_array: return array of maximum values

  • x_array: corresponding horizontal positions

  • y_array: corresponding vertical positions

This operation finds the maximum value in an image.

By default it finds the single largest value. Ifsize is set >1, it willfind thesize largest values. It will stop searching early if has foundenough values.Equal values will be sorted by y then x.

It operates on allbands of the input image: usevips_stats() if you need to find anmaximum for each band.

For complex images, this operation finds the maximum modulus.

You can read out the position of the maximum withx andy. You can readout arrays of the values and positions of the topsize maxima without_array,x_array andy_array. These values are returned sorted fromlargest to smallest.

If there are more thansize maxima, the maxima returned will be a randomselection of the maxima in the image.

See also:vips_min(),vips_stats().

[method]

Parameters

in

inputVipsImage

 

out

output pixel maximum.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_stats ()

intvips_stats (VipsImage *in,VipsImage **out,...);

Find many image statistics in a single pass through the data.out is aone-bandVIPS_FORMAT_DOUBLE image of at least 10 columns by n + 1(where n is number of bands in imagein)rows. Columns are statistics, and are, in order: minimum, maximum, sum,sum of squares, mean, standard deviation, x coordinate of minimum, ycoordinate of minimum, x coordinate of maximum, y coordinate of maximum.Later versions ofvips_stats() may add more columns.

Row 0 has statistics for allbands together, row 1 has stats for band 1, and so on.

If there is more than one maxima or minima, one of them will be chosen atrandom.

See also:vips_avg(),vips_min().

[method]

Parameters

in

image to scan

 

out

image of statistics.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_measure ()

intvips_measure (VipsImage *in,VipsImage **out,int h,int v,...);

Optional arguments:

  • left: area of image containing chart

  • top: area of image containing chart

  • width: area of image containing chart

  • height: area of image containing chart

Analyse a grid of colour patches, producing an array of patch averages.The mask has a row for each measured patch and a column for each imageband. The operations issues a warning if any patch has a deviation morethan 20% ofthe mean. Only the central 50% of each patch is averaged.

If the chart does not fill the whole image, use the optionalleft,top,width,height arguments to indicate theposition of the chart.

See also:vips_avg(),vips_deviate().

[method]

Parameters

in

image to measure

 

out

array of measurements.

[out]

h

patches across chart

 

v

patches down chart

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_find_trim ()

intvips_find_trim (VipsImage *in,int *left,int *top,int *width,int *height,...);

Optional arguments:

  • threshold:gdouble, background / object threshold

  • background:VipsArrayDouble, background colour

  • line_art:gboolean, enable line art mode

Searchin for the bounding box of the non-background area.

Any alpha is flattened out, then the image is median-filtered (unlessline_art is set, see below). The absolute difference frombackground iscomputed and binarized according tothreshold. Row and column sums ofthe absolute difference are calculated from this binary image and searchedfor the first row or column in each direction to obtain the bounding box.

If the image is entirely background,vips_find_trim() returnswidth == 0andheight == 0.

background defaults to 255, or 65535 for 16-bit images. Set another value,or usevips_getpoint() to pick a value from an edge. You'll need to flattenbeforevips_getpoint() to get a correct background value.

threshold defaults to 10.

The detector is designed for photographic or compressed images where thereis a degree of noise that needs filtering. If your images are synthetic(eg. rendered from vector art, perhaps), setline_art to disable thisfiltering.

The image needs to be at least 3x3 pixels in size.

See also:vips_getpoint(),vips_extract_area(),vips_smartcrop().

[method]

Parameters

in

image to find_trim

 

left

output left edge.

[out]

top

output top edge.

[out]

width

output width.

[out]

height

output height.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_getpoint ()

intvips_getpoint (VipsImage *in,double **vector,int *n,int x,int y,...);

Reads a single pixel on an image.

The pixel values are returned invector, the length of thearray inn. You must free the array withg_free() when you are done withit.

The result array has an element for each band. Ifunpack_complex is set,pixels in complex images are returned as double-length arrays.

See also:vips_draw_point().

[method]

Parameters

in

image to read from

 

vector

output pixel value here.

[out][array length=n]

n

length of output vector

 

x

position to read

 

y

position to read

 

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, or -1 on error.


vips_hist_find ()

intvips_hist_find (VipsImage *in,VipsImage **out,...);

Optional arguments:

  • band: band to equalise

Find the histogram ofin. Find the histogram for bandband (producing aone-band histogram), or for all bands (producing an n-band histogram) ifband is -1.

char and uchar images are cast to uchar before histogramming, all otherimage types are cast to ushort.

See also:vips_hist_find_ndim(),vips_hist_find_indexed().

[method]

Parameters

in

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_hist_find_ndim ()

intvips_hist_find_ndim (VipsImage *in,VipsImage **out,...);

Optional arguments:

  • bins: number of bins to make on each axis

Make a one, two or three dimensional histogram of a 1, 2 or3 band image. Divide each axis intobins bins .. ie.output is 1 x bins, bins x bins, or bins x bins x bins bands.bins defaults to 10.

char and uchar images are cast to uchar before histogramming, all otherimage types are cast to ushort.

See also:vips_hist_find(),vips_hist_find_indexed().

[method]

Parameters

in

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_hist_find_indexed ()

intvips_hist_find_indexed (VipsImage *in,VipsImage *index,VipsImage **out,...);

Optional arguments:

Make a histogram ofin, but use imageindex to pick the bins. In otherwords, element zero inout contains the combination of all the pixels ininwhose corresponding pixel inindex is zero.

char and ucharindex images are cast to uchar before histogramming, allother image types are cast to ushort.index must have just one band.

in must be non-complex.

out always has the same size and format asin.

Normally, bins are summed, but you can usecombine to set other combinemodes.

This operation is useful in conjunction withvips_labelregions(). You canuse it to find the centre of gravity of blobs in an image, for example.

See also:vips_hist_find(),vips_labelregions().

[method]

Parameters

in

inputVipsImage

 

index

input indexVipsImage

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_hough_line ()

intvips_hough_line (VipsImage *in,VipsImage **out,...);

Optional arguments:

  • width: horizontal size of parameter space

  • height: vertical size of parameter space

Find the line Hough transform forin.in must have one band.out has oneband, with pixels being the number of votes for that line. The X dimensionofout is the line angle in 0 - 180 degrees, the Y dimension is thedistance of the closest part of that line to the origin in the top-left.

Usewidthheight to set the size of the parameter space image (out),that is, how accurate the line determination should be.

See also:vips_hough_circle().

[method]

Parameters

in

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_hough_circle ()

intvips_hough_circle (VipsImage *in,VipsImage **out,...);

Optional arguments:

  • scale: scale down dimensions by this much

  • min_radius: smallest radius to search for

  • max_radius: largest radius to search for

Find the circular Hough transform of an image.in must be one band, withnon-zero pixels for image edges.out is three-band, with the third channelrepresenting the detected circle radius. The operation scales the number ofvotes by circle circumference so circles of differing size are given equalweight.

The output pixel at (x, y, band) is the strength of the circle centred on(x, y) and with radius (band).

Usemax_radius andmin_radius to set the range of radii to search for.

Usescale to set howin coordinates are scaled toout coordinates. Ascale of 3, for example, will makeout 1/3rd of the width and height ofin, and reduce the number of radii tested (and hence the number of bandsintout) by a factor of three as well.

See also:vips_hough_line().

[method]

Parameters

in

input image

 

out

output image.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_project ()

intvips_project (VipsImage *in,VipsImage **columns,VipsImage **rows,...);

Find the horizontal and vertical projections of an image, ie. the sumof every row of pixels, and the sum of every column of pixels. The outputformat is uint, int or double, depending on the input format.

Non-complex images only.

See also:vips_hist_find(),vips_profile().

[method]

Parameters

in

input image

 

columns

sums of columns.

[out]

rows

sums of rows.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error


vips_profile ()

intvips_profile (VipsImage *in,VipsImage **columns,VipsImage **rows,...);

vips_profile() searches inward from the edge ofin and finds thefirst non-zero pixel. Pixels incolumns have the distance from the top edgeto the first non-zero pixel in that column,rows has the distance from theleft edge to the first non-zero pixel in that row.

See also:vips_project(),vips_hist_find().

[method]

Parameters

in

input image

 

columns

distances from top edge.

[out]

rows

distances from left edge.

[out]

...

NULL-terminated list of optional named arguments

 

Returns

0 on success, -1 on error

Types and Values

enum VipsOperationMath

See also:vips_math().

Members

VIPS_OPERATION_MATH_SIN

sin(), angles in degrees

 

VIPS_OPERATION_MATH_COS

cos(), angles in degrees

 

VIPS_OPERATION_MATH_TAN

tan(), angles in degrees

 

VIPS_OPERATION_MATH_ASIN

asin(), angles in degrees

 

VIPS_OPERATION_MATH_ACOS

acos(), angles in degrees

 

VIPS_OPERATION_MATH_ATAN

atan(), angles in degrees

 

VIPS_OPERATION_MATH_LOG

log base e

 

VIPS_OPERATION_MATH_LOG10

log base 10

 

VIPS_OPERATION_MATH_EXP

e to the something

 

VIPS_OPERATION_MATH_EXP10

10 to the something

 

VIPS_OPERATION_MATH_SINH

sinh(), angles in radians

 

VIPS_OPERATION_MATH_COSH

cosh(), angles in radians

 

VIPS_OPERATION_MATH_TANH

tanh(), angles in radians

 

VIPS_OPERATION_MATH_ASINH

asinh(), angles in radians

 

VIPS_OPERATION_MATH_ACOSH

acosh(), angles in radians

 

VIPS_OPERATION_MATH_ATANH

atanh(), angles in radians

 

VIPS_OPERATION_MATH_LAST

  

enum VipsOperationMath2

See also:vips_math().

Members

VIPS_OPERATION_MATH2_POW

pow(left, right)

 

VIPS_OPERATION_MATH2_WOP

pow(right, left)

 

VIPS_OPERATION_MATH2_ATAN2

atan2(left, right)

 

VIPS_OPERATION_MATH2_LAST

  

enum VipsOperationRound

See also:vips_round().

Members

VIPS_OPERATION_ROUND_RINT

round to nearest

 

VIPS_OPERATION_ROUND_CEIL

the smallest integral value not less than

 

VIPS_OPERATION_ROUND_FLOOR

largest integral value not greater than

 

VIPS_OPERATION_ROUND_LAST

  

enum VipsOperationRelational

See also:vips_relational().

Members

VIPS_OPERATION_RELATIONAL_EQUAL

==

 

VIPS_OPERATION_RELATIONAL_NOTEQ

!=

 

VIPS_OPERATION_RELATIONAL_LESS

<

 

VIPS_OPERATION_RELATIONAL_LESSEQ

<=

 

VIPS_OPERATION_RELATIONAL_MORE

 

VIPS_OPERATION_RELATIONAL_MOREEQ

=

 

VIPS_OPERATION_RELATIONAL_LAST

  

enum VipsOperationBoolean

See also:vips_boolean().

Members

VIPS_OPERATION_BOOLEAN_AND

&

 

VIPS_OPERATION_BOOLEAN_OR

|

 

VIPS_OPERATION_BOOLEAN_EOR

^

 

VIPS_OPERATION_BOOLEAN_LSHIFT

>

 

VIPS_OPERATION_BOOLEAN_RSHIFT

<<

 

VIPS_OPERATION_BOOLEAN_LAST

  

enum VipsOperationComplex

See also:vips_complex().

Members

VIPS_OPERATION_COMPLEX_POLAR

convert to polar coordinates

 

VIPS_OPERATION_COMPLEX_RECT

convert to rectangular coordinates

 

VIPS_OPERATION_COMPLEX_CONJ

complex conjugate

 

VIPS_OPERATION_COMPLEX_LAST

  

enum VipsOperationComplex2

See also:vips_complex2().

Members

VIPS_OPERATION_COMPLEX2_CROSS_PHASE

convert to polar coordinates

 

VIPS_OPERATION_COMPLEX2_LAST

  

enum VipsOperationComplexget

See also:vips_complexget().

Members

VIPS_OPERATION_COMPLEXGET_REAL

get real component

 

VIPS_OPERATION_COMPLEXGET_IMAG

get imaginary component

 

VIPS_OPERATION_COMPLEXGET_LAST

  

Generated by GTK-Doc V1.34.0

[8]ページ先頭

©2009-2025 Movatter.jp