Table of Contents

## Name

im_similarity_area, im_similarity - apply a similarity transform to an image

## Synopsis

#include <vips/vips.h>

int im_similarity_area(in, out, s, a, dx, dy, w, h, x, y)
IMAGE *in, *out;
double s, a, dx, dy;
int w, h, x, y;

int im_similarity(in, out, s, a, dx, dy)
IMAGE *in, *out;
double s, a, dx, dy;

## Description

im_similarity_area() applies a similarity transformation on the image held by the IMAGE descriptor in and puts the result at the location pointed by the IMAGE descriptor out. in many have any number of bands, be any size, and have any non-complex type.

The transformation is described by s, a, dx, dy. The point (x,y) in the input is mapped onto point (X,Y) in the output by

`` `` X = s * x - a * y + dx
`` `` Y = a * x + s * y + dy

s and a do not correspond to scale and angle of the transformation; the actual scale and angle are given by the equations:

`` `` scale = sqrt(s*s + a*a)
`` `` angle = arctan(s/a).

The area of the output image given by w, h, x, y is generated. (0,0) is the position of the transformed top-left-hand corner of the input image. Function im_similarity_area resamples the transformed image using bilinear interpolation.

im_similarity works exactly as im_similarity_area, but calculates w, h, x, y for you such that the rectangle described just encloses all of the transformed input pixels.

## Return Value

The functions return 0 on success and -1 on error.

## Bugs

As with most resamplers, im_similarity performs poorly at the edges of images.

## See Also

similarity(1) , similarity_area(1)

## Authors

N. Dessipris - 13/01/1992
J.Ph. Laurent - 12/12/92
J. Cupitt - 22/02/93

Table of Contents

- Name
- Synopsis
- Description
- Return Value
- Bugs
- SeeAlso
- Authors