Method

VipsImagestdif

Declaration [src]

int
vips_stdif (
  VipsImage* in,
  VipsImage** out,
  int width,
  int height,
  ...
)

Description [src]

vips_stdif() performs statistical differencing according to the formula given in page 45 of the book “An Introduction to Digital Image Processing” by Wayne Niblack.

This transformation emphasises the way in which a pel differs statistically from its neighbours. It is useful for enhancing low-contrast images with lots of detail, such as X-ray plates.

At point (i,j) the output is given by the equation:

vout(i,j) = @a * @m0 + (1 - @a) * meanv +
      (vin(i,j) - meanv) * (@b * @s0) / (@s0 + @b * stdv)

Values a, m0, b and s0 are entered, while meanv and stdv are the values calculated over a moving window of size width, height centred on pixel (i,j). m0 is the new mean, a is the weight given to it. s0 is the new standard deviation, b is the weight given to it.

Try:

$ vips stdif $VIPSHOME/pics/huysum.v fred.v 0.5 128 0.5 50 11 11

It works for uchar images only, with any number of bands. The input is expanded by copying edge pixels before performing the operation so that the output image has the same size as the input. Edge pixels in the output image are therefore only approximate.

Optional arguments

  • a: gdouble, weight of new mean
  • m0: gdouble, target mean
  • b: gdouble, weight of new deviation
  • s0: gdouble, target deviation

See also

vips_hist_local().

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

Type: int

Width of region.

height

Type: int

Height of region.

...

Type: 

NULL-terminated list of optional named arguments.

Return value

Type: int

0 on success, -1 on error.