int
vips_find_trim (
VipsImage* in,
int* left,
int* top,
int* width,
int* height,
...
)
Description [src]
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.
Optional arguments
threshold
: gdouble
, background / object thresholdbackground
: VipsArrayDouble
, background colourline_art
: gboolean
, enable line art modeThis method is not directly available to language bindings.
Parametersleft
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.
Type: int
0 on success, -1 on error.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4