Top | Description | Object Hierarchy | ![]() | ![]() | ![]() | ![]() |
GEnum├── VipsOperationBoolean├── VipsOperationComplex├── VipsOperationComplex2├── VipsOperationComplexget├── VipsOperationMath├── VipsOperationMath2├── VipsOperationRelational╰── VipsOperationRound
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 /in1 | uchar | char | ushort | short | uint | int | float | double | complex | double complex |
---|---|---|---|---|---|---|---|---|---|---|
uchar | ushort | short | ushort | short | uint | int | float | double | complex | double complex |
char | short | short | short | short | int | int | float | double | complex | double complex |
ushort | ushort | short | ushort | short | uint | int | float | double | complex | double complex |
short | short | short | short | short | int | int | float | double | complex | double complex |
uint | uint | int | uint | int | uint | int | float | double | complex | double complex |
int | int | int | int | int | int | int | float | double | complex | double complex |
float | float | float | float | float | float | float | float | double | complex | double complex |
double | double | double | double | double | double | double | double | double | double complex | double complex |
complex | complex | complex | complex | complex | complex | complex | complex | double complex | complex | double complex |
double complex | double complex | double complex | double complex | double complex | double complex | double complex | double complex | double complex | double complex | double 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.
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 thefollowing table is used to determine the output type:
Table 4. VipsAdd type promotion
input type | output type |
---|---|
uchar | ushort |
char | short |
ushort | uint |
short | int |
uint | uint |
int | int |
float | float |
double | double |
complex | complex |
double complex | double complex |
In other words, the output type is just large enough to hold the wholerange of possible values.
See also:vips_subtract()
,vips_linear()
.
left | input image | |
right | input image | |
out | output image. | [out] |
... |
|
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 thefollowing table is used to determine the output type:
Table 5. VipsSum type promotion
input type | output type |
---|---|
uchar | uint |
char | int |
ushort | uint |
short | int |
uint | uint |
int | int |
float | float |
double | double |
complex | complex |
double complex | double complex |
In other words, the output type is just large enough to hold the wholerange of possible values.
See also:vips_add()
.
in | array of input images. | [array length=n] |
out | output image. | [out] |
n | number of input images | |
... |
|
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 thefollowing table is used to determine the output type:
Table 6. VipsSubtract type promotion
input type | output type |
---|---|
uchar | short |
char | short |
ushort | int |
short | int |
uint | int |
int | int |
float | float |
double | double |
complex | complex |
double complex | double complex |
In other words, the output type is just large enough to hold the wholerange of possible values.
See also:vips_add()
,vips_linear()
.
in1 | input image | |
in2 | input image | |
out | output image. | [out] |
... |
|
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 thefollowing table is used to determine the output type:
Table 7. VipsMultiply type promotion
input type | output type |
---|---|
uchar | ushort |
char | short |
ushort | uint |
short | int |
uint | uint |
int | int |
float | float |
double | double |
complex | complex |
double complex | double complex |
In other words, the output type is just large enough to hold the wholerange of possible values.
See also:vips_add()
,vips_linear()
.
left | left-hand image | |
right | right-hand image | |
out | output image. | [out] |
... |
|
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 thefollowing table is used to determine the output type:
Table 8. vips_divide()
type promotion
input type | output type |
---|---|
uchar | float |
char | float |
ushort | float |
short | float |
uint | float |
int | float |
float | float |
double | double |
complex | complex |
double complex | double 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()
.
left | input image | |
right | input image | |
out | output image. | [out] |
... |
|
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()
.
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 | |
... |
|
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()
.
in | image to transform | |
out | output image. | [out] |
a | constant for multiplication | |
b | constant for addition | |
... |
|
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 theresult type.
See also:vips_remainder_const()
,vips_divide()
,vips_round()
.
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()
.
in | input image | |
out | output image. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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()
.
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()
.
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()
.
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()
.
intvips_maxpair (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
For each pixel, pick the maximum of a pair of images.
See also:vips_minpair()
.
left | input image | |
right | input image | |
out | output image. | [out] |
... |
|
intvips_minpair (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
For each pixel, pick the minimum of a pair of images.
See also:vips_minpair()
.
left | input image | |
right | input image | |
out | output image. | [out] |
... |
|
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()
in | inputVipsImage | |
out | outputVipsImage. | [out] |
round | VipsOperationRound rounding operation to perform | |
... |
|
intvips_floor (VipsImage *in
,VipsImage **out
,...
);
Round to an integral value withVIPS_OPERATION_ROUND_FLOOR. Seevips_round()
.
intvips_ceil (VipsImage *in
,VipsImage **out
,...
);
Round to an integral value withVIPS_OPERATION_ROUND_CEIL. Seevips_round()
.
intvips_rint (VipsImage *in
,VipsImage **out
,...
);
Round to an integral value withVIPS_OPERATION_ROUND_RINT. Seevips_round()
.
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()
.
intvips_sin (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_SIN on an image. Seevips_math()
.
intvips_cos (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_COS on an image. Seevips_math()
.
intvips_tan (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_TAN on an image. Seevips_math()
.
intvips_asin (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_ASIN on an image. Seevips_math()
.
intvips_acos (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_ACOS on an image. Seevips_math()
.
intvips_atan (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_ATAN on an image. Seevips_math()
.
intvips_exp (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_EXP on an image. Seevips_math()
.
intvips_exp10 (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_EXP10 on an image. Seevips_math()
.
intvips_log (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_LOG on an image. Seevips_math()
.
intvips_log10 (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_LOG10 on an image. Seevips_math()
.
intvips_sinh (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_SINH on an image. Seevips_math()
.
intvips_cosh (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_COSH on an image. Seevips_math()
.
intvips_tanh (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_TANH on an image. Seevips_math()
.
intvips_asinh (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_ASINH on an image. Seevips_math()
.
intvips_acosh (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_ACOSH on an image. Seevips_math()
.
intvips_atanh (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH_ATANH on an image. Seevips_math()
.
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.
intvips_polar (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_COMPLEX_POLAR on an image. Seevips_complex()
.
intvips_rect (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_COMPLEX_RECT on an image. Seevips_complex()
.
intvips_conj (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_COMPLEX_CONJ on an image. Seevips_complex()
.
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.
intvips_cross_phase (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_COMPLEX2_CROSS_PHASE on an image.Seevips_complex2()
.
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.
intvips_real (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_COMPLEXGET_REAL on an image. Seevips_complexget()
.
intvips_imag (VipsImage *in
,VipsImage **out
,...
);
PerformVIPS_OPERATION_COMPLEXGET_IMAG on an image. Seevips_complexget()
.
intvips_complexform (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
Compose two real images to make a complex image. If eitherleft
orright
areVIPS_FORMAT_DOUBLE,out
isVIPS_FORMAT_DPCOMPLEX. Otherwiseout
isVIPS_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()
.
left | input image | |
right | input image | |
out | output image. | [out] |
... |
|
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()
.
intvips_equal (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_RELATIONAL_EQUAL on a pair of images. Seevips_relational()
.
intvips_notequal (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_RELATIONAL_NOTEQ on a pair of images. Seevips_relational()
.
intvips_less (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_RELATIONAL_LESS on a pair of images. Seevips_relational()
.
intvips_lesseq (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_RELATIONAL_LESSEQ on a pair of images. Seevips_relational()
.
intvips_more (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_RELATIONAL_MORE on a pair of images. Seevips_relational()
.
intvips_moreeq (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_RELATIONAL_MOREEQ on a pair of images. Seevips_relational()
.
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()
.
in | input image | |
out | output image. | [out] |
relational | relational operation to perform | |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_equal_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. Seevips_relational_const()
.
in | inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_notequal_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_RELATIONAL_NOTEQ on an image and a constant. Seevips_relational_const()
.
in | inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_less_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_RELATIONAL_LESS on an image and a constant. Seevips_relational_const()
.
in | inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_lesseq_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. Seevips_relational_const()
.
in | inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_more_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_RELATIONAL_MORE on an image and a constant. Seevips_relational_const()
.
in | inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_moreeq_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. Seevips_relational_const()
.
in | inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
relational | relational operation to perform | |
c | constant | |
... |
|
intvips_equal_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. Seevips_relational_const()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
intvips_notequal_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_RELATIONAL_NOTEQ on an image and a constant. Seevips_relational_const()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
intvips_less_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_RELATIONAL_LESS on an image and a constant. Seevips_relational_const()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
intvips_lesseq_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. Seevips_relational_const()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
intvips_more_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_RELATIONAL_MORE on an image and a constant. Seevips_relational_const()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
intvips_moreeq_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. Seevips_relational_const()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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()
.
intvips_andimage (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_BOOLEAN_AND on a pair of images. Seevips_boolean()
.
intvips_orimage (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_BOOLEAN_OR on a pair of images. Seevips_boolean()
.
intvips_eorimage (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_BOOLEAN_EOR on a pair of images. Seevips_boolean()
.
intvips_lshift (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_BOOLEAN_LSHIFT on a pair of images. Seevips_boolean()
.
intvips_rshift (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_BOOLEAN_RSHIFT on a pair of images. Seevips_boolean()
.
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()
.
in | input image | |
out | output image. | [out] |
boolean | boolean operation to perform | |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
boolean | boolean operation to perform | |
c | constant | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
c | constant | |
... |
|
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 ofleft
orright
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 theresult type.
See also:vips_math2_const()
.
intvips_pow (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH2_POW on a pair of images. Seevips_math2()
.
intvips_wop (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH2_WOP on a pair of images. Seevips_math2()
.
intvips_atan2 (VipsImage *left
,VipsImage *right
,VipsImage **out
,...
);
PerformVIPS_OPERATION_MATH2_ATAN2 on a pair of images. Seevips_math2()
.
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 thatin
is 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()
.
in | input image | |
out | output image. | [out] |
math2 | math operation to perform | |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_pow_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_MATH2_POW on an image and a constant. Seevips_math2_const()
.
in | left-hand inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_wop_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_MATH2_WOP on an image and a constant. Seevips_math2_const()
.
in | left-hand inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
intvips_atan2_const (VipsImage *in
,VipsImage **out
,constdouble *c
,int n
,...
);
PerformVIPS_OPERATION_MATH2_ATAN2 on an image and a constant. Seevips_math2_const()
.
in | left-hand inputVipsImage | |
out | outputVipsImage. | [out] |
c | array of constants. | [array length=n] |
n | number of constants in | |
... |
|
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()
.
in | input image | |
out | output image. | [out] |
math2 | math operation to perform | |
c | constant | |
... |
|
intvips_pow_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_MATH2_POW on an image and a constant. Seevips_math2_const()
.
intvips_wop_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_MATH2_WOP on an image and a constant. Seevips_math2_const()
.
intvips_atan2_const1 (VipsImage *in
,VipsImage **out
,double c
,...
);
PerformVIPS_OPERATION_MATH2_ATAN2 on an image and a constant. Seevips_math2_const()
.
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()
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()
..
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()
.
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()
.
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()
.
in | image to scan | |
out | image of statistics. | [out] |
... |
|
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()
.
in | image to measure | |
out | array of measurements. | [out] |
h | patches across chart | |
v | patches down chart | |
... |
|
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()
.
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()
.
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 | |
... |
|
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.
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()
.
intvips_hist_find_indexed (VipsImage *in
,VipsImage *index
,VipsImage **out
,...
);
Optional arguments:
combine
:VipsCombine, combine bins like this
Make a histogram ofin
, but use imageindex
to pick the bins. In otherwords, element zero inout
contains the combination of all the pixels inin
whose 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()
.
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.
Usewidth
height
to set the size of the parameter space image (out
),that is, how accurate the line determination should be.
See also: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()
.
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()
.
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()
.
See also:vips_math()
.
sin(), angles in degrees | ||
cos(), angles in degrees | ||
tan(), angles in degrees | ||
asin(), angles in degrees | ||
acos(), angles in degrees | ||
atan(), angles in degrees | ||
log base e | ||
log base 10 | ||
e to the something | ||
10 to the something | ||
sinh(), angles in radians | ||
cosh(), angles in radians | ||
tanh(), angles in radians | ||
asinh(), angles in radians | ||
acosh(), angles in radians | ||
atanh(), angles in radians | ||