 im_stdif(3) statistical differentiation of an image

Other Alias

im_stdif_raw

## SYNOPSIS

#include <vips/vips.h>

int im_stdif(in, out, a, m0, b, s0, xw, yw)
IMAGE *in, *out;
double a, m0, b, s0;
int xw, yw;

int im_stdif_raw(in, out, a, m0, b, s0, xw, yw)
IMAGE *in, *out;
double a, m0, b, s0;
int xw, yw;

## DESCRIPTION

im_stdif() preforms 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 eqn:

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 xw, yw 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:

im_stdif \$VIPSHOME/pics/huysum.v fred.v 0.5 128 0.5 50 11 11

The opreation works on one-band UCHAR images only, and writes a one-band UCHAR image as its result. The output image has the same size as the input - a black border is added to mark uncomputable pixels.

im_stdif_raw() behaves exactly as im_stdif(), but does not add the border of black pixels.

## RETURN VALUE

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