Method
VipsImagefind_trim
Declaration [src]
int
vips_find_trim (
VipsImage* in,
int* left,
int* top,
int* width,
int* height,
...
)
Description [src]
Optional arguments
threshold
: %gdouble, background / object thresholdbackground
:VipsArrayDouble
, background colourline_art
: %gboolean, enable line art mode
Search in
for the bounding box of the non-background area.
Any alpha is flattened out, then the image is median-filtered (unless
line_art
is set, see below). The absolute difference from background
is
computed and binarized according to threshold
. Row and column sums of
the absolute difference are calculated from this binary image and searched
for the first row or column in each direction to obtain the bounding box.
If the image is entirely background, vips_find_trim()
returns width
== 0
and height
== 0.
background
defaults to 255, or 65535 for 16-bit images. Set another value,
or use vips_getpoint()
to pick a value from an edge. You’ll need to flatten
before vips_getpoint()
to get a correct background value.
threshold
defaults to 10.
The detector is designed for photographic or compressed images where there
is a degree of noise that needs filtering. If your images are synthetic
(eg. rendered from vector art, perhaps), set line_art
to disable this filtering.
The image needs to be at least 3x3 pixels in size.
See also
This method is not directly available to language bindings.
Parameters
left
-
Type:
int*
Output left edge.
The argument will be set by the function. top
-
Type:
int*
Output top edge.
The argument will be set by the function. width
-
Type:
int*
Output width.
The argument will be set by the function. height
-
Type:
int*
Output height.
The argument will be set by the function. ...
-
Type:
NULL
-terminated list of optional named arguments.