Vips.Image.globalbalance

### Method

# Vips Imageglobalbalance

#### Declaration [src]

    int
    vips_globalbalance (
      VipsImage* in,
      VipsImage** out,
      ...
    )

#### Description [src]

`vips_globalbalance()` can be used to remove contrast differences in an assembled mosaic.

It reads the History field attached to `in` and builds a list of the source images that were used to make the mosaic and the position that each ended up at in the final image.

It opens each of the source images in turn and extracts all parts which overlap with any of the other images. It finds the average values in the overlap areas and uses least-mean-square to find a set of correction factors which will minimise overlap differences. It uses `gamma` to gamma-correct the source images before calculating the factors. A value of 1.0 will stop this.

Each of the source images is transformed with the appropriate correction factor, then the mosaic is reassembled. `out` is `VIPS_FORMAT_FLOAT`, but if `int_output` is set, the output image is the same format as the input images.

There are some conditions that must be met before this operation can work: the source images must all be present under the filenames recorded in the history on `in`, and the mosaic must have been built using only operations in this package.

Optional arguments

- `gamma`: `gdouble`, gamma of source images
- `int_output`: `gboolean`, `TRUE` for integer image output

See also

`vips_mosaic()`.

This method is not directly available to language bindings.

#### Parameters

`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.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.