Vips.Image.mosaic

### Method

# Vips Imagemosaic

#### Declaration [src]

    int
    vips_mosaic (
      VipsImage* ref,
      VipsImage* sec,
      VipsImage** out,
      VipsDirection direction,
      int xref,
      int yref,
      int xsec,
      int ysec,
      ...
    )

#### Description [src]

This operation joins two images left-right (with `ref` on the left) or top-bottom (with `ref` above) given an approximate overlap.

`sec` is positioned so that the pixel (`xsec`, `ysec`) in `sec` lies on top of the pixel (`xref`, `yref`) in `ref`. The overlap area is divided into three sections, 20 high-contrast points in band `bandno` of image `ref` are found in each, and a window of pixels of size `hwindow` around each high-contrast point is searched for in `sec` over an area of `harea`.

A linear model is fitted to the 60 tie-points, points a long way from the fit are discarded, and the model refitted until either too few points remain or the model reaches good agreement.

The detected displacement is used with `vips_merge()` to join the two images together.

You can read out the detected transform with `dx0`, `dy0`, `scale1`, `angle1`, `dx1`, `dy1`.

Optional arguments

- `bandno`: `gint`, band to search for features
- `hwindow`: `gint`, half window size
- `harea`: `gint`, half search size
- `mblend`: `gint`, maximum blend size
- `dx0`: `gint`, output, detected displacement
- `dy0`: `gint`, output, detected displacement
- `scale1`: `gdouble`, output, detected first order scale
- `angle1`: `gdouble`, output, detected first order rotation
- `dx1`: `gdouble`, output, detected first order displacement
- `dy1`: `gdouble`, output, detected first order displacement

See also

`vips_merge()`, `vips_insert()`.

This method is not directly available to language bindings.

#### Parameters

`sec`

  Type: `VipsImage`

  Secondary image.

  The data is owned by the caller of the method.

`out`

  Type: `VipsImage`

  Output image.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`direction`

  Type: `VipsDirection`

  Horizontal or vertical join.

`xref`

  Type: `int`

  Position in reference image.

`yref`

  Type: `int`

  Position in reference image.

`xsec`

  Type: `int`

  Position in secondary image.

`ysec`

  Type: `int`

  Position in secondary image.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.