Name

imvariance — Calculates the variance of an image

Calling Sequence

variance_matrix = imvariance(image)

Parameters

image
A gray-level image.

Description

This function computes a matrix containing the variance of each point of an image.

The variance is the sum of the absolute value of the differences between the central pixel and its neighbours:

variance=sum(|x(neighbour)-x(central)|)

A low variance value means a pixel is not very different from its neigbours (in all directions).

This property can be used to unwrap phased images. In case of a "path-following algorithm", the variance can be a "merit function" used to determine which pixels should be connected first. This "merit function" is much more noise immune than a "merit function" based on a laplace kernel.

This algorithm calculates the variance everywhere even on the edges. In some cases, consider multiplying by a mask like this

 [8/3 8/5 8/5...;
  8/5   1   1...;
 

so that edge values are really significative.

Examples

stacksize(1e7); // images are very much memory consumming...

varian=imvariance(imread(SIPDIR+'images/photonics/pyramide_wrapped.jpg'));

imshow(varian/max(varian)); // high levels (blank on the image) 
				                // represent points where intensity
				                // changes quickly
   

Authors

Jocelyn DRUEL <jocelyn.druel1@libertysurf.fr>

Availability

The latest version of the Scilab Image Processing toolbox can be found at

http://siptoolbox.sourceforge.net

See Also

unwrapl , mkfilter('laplace1')