Table of Contents

## Name

im_compass, im_rank_image, im_lindetect, im_gradient - extract features from an image with a rotating input mask

## Synopsis

#include <vips/vips.h>

int im_rank_image(in, out, n, index)
IMAGE **in;
IMAGE *out;
int n;
int index;

int im_compass(in, out, mask)
IMAGE *in, *out;
INTMASK *mask;

int im_lindetect(in, out, mask)
IMAGE *in, *out;
INTMASK *mask;

int im_gradient(in, out, mask)
IMAGE *in, *out;
INTMASK *mask;

## Description

im_rank_image() sorts the input images pixel-wise, then outputs an image in which each pixel is selected from the sorted list by the index parameter. For example, if index is zero, then each output pixel will be the minimum of all the corresponding input pixels. It works for any uncoded, non-complex image type. All input images must match in size, format, and number of bands.

These functions convolve the image pointed by the image descriptor in with the mask pointed by mask and put the result in the image pointed by out.

The mask structure INTMASK is returned by the function im_read_imask(3) , for integer mask only. Input should be unsigned char; processing is carried out using look-up tables. The output is integer. coefficients. The size of the output image and the number of channels are the same as the corresponding of the input.

If the sizes of the mask are xm and ym and the sizes of the image are xs and ys, then there is a black border at the output image as follows:

The top ym/2 lines black, bottom ys-ym/2-ym lines black; each of the remaining lines has the initial xm/2 pels blank, and the final xs-xm/2-xm pels black (division over 2 is integer division). The output at each point is divided by scale and then the offset is added. Both offset and scale are held in mask.

im_compass() convolves each point of the input byte image pointed by in with 8 masks. The first mask is the entered mask and the seven remaining masks are produced by successive rotations of the entered mask by 45 degrees. The maximum output of all masks at each point is written to the output integer IMAGE descriptor. The function expects as input a square mask of odd size.

im_lindetect() convolves each point of the input byte image pointed by in with 4 masks. The first mask is the entered mask and the three remaining masks are produced by successive rotations of the entered mask by 45 degrees. The maximum output of all masks at each point is written to the output integer IMAGE descriptor. The function expects as input a square mask of odd size.

im_gradient() convolves each point of the input byte image pointed by in with 2 masks; the entered mask and with a 90 degrees rotation of the entered mask. If g1, g2 are the result of each convolution then for each point abs(g1) + abs(g2) is written to the output integer IMAGE descriptor. The function expects as input a square mask of any size.

## Return Value

All functions returns 0 on success and -1 on error.

## See Also

im_readmask(3) , im_conv(3) .

## Copyright

N. Dessipris

## Author

N. Dessipris - 02/05/1991

Table of Contents

- Name
- Synopsis
- Description
- Return Value
- SeeAlso
- Copyright
- Author