RETRO (vipl) functions


LIBRARY ROUTINE

lvshape - Performs shape analysis on images.

LIBRARY CALL

int lvshape(
	int image_type,
	xvimage *image,
	int typ_axe,
	int typ_color,
	int axis_flg,
	xvimage **axis,
	int outline_flg,
	xvimage **outline,
	int viff_flg,
	xvimage **img3,
	int file_flg,
	char *input_file,
	kfile *printdev,
	int standard,
	int central,
	int invariant)

INPUT

OUTPUT

RETURN VALUE

TRUE (1) on success, FALSE (0) on failure

DESCRIPTION

lvshape performs a shape analysis on two different types of images, by extracting features like moments, area, centroids, etc.

The input "image" is a pointer to an INT xvimage that can be:

A grey level image -- In this particular case, the features will be computed for the entire image. Some of these features may not appear to make sense, nevertheless they will still contribute significant information to the regions.

A labeled or clustered image -- The grey level of a pixel in a labeled or clustered image is specifically used to assign a pixel to a particular labeled region. For a labeled image (output of vlabel ipl routine), the classes or regions are connected, however this is not true for a cluster number image (output of vquant, vkmeans or visodata). This difference can confuse a novice user, because vshape will not differentiate between connected or non-connected regions.

General Description of lvshape.

The features listed below are computed for each region or for the entire image, depending on the input image.

- Centroid on x and y axis. - Variances on x and y. - Area or weighted area. - Orientation of the principal axis. - Eccentricity of the shape. - Bounded box coordinates.

Theses features are optional.

- Standard Moments. - Central Moments and Normalized Central Moments. - Invariant Moments.

These features are provided in an optional ASCII file.

As mentioned above, the centroid coordinates of the grey level input image provides more information than the general sense of the centroid of a region.

In addition to the ASCII file, three other output files can be generated.

The Axis Image -- This image contains a representation of the moments of the regions contained in the input image. It can only be generated when the input image is a not a grey level image. There are two possibilities for representing the moment.

The first one is an image containing a cross for each region. The cross center is located at the centroid of the region and the horizontal and vertical axes stop outside of the bounded box of the region.

The second one is an image still containing a cross for each region but this time the cross is representative of the moment value in the principal axis system. The principal axis is the coordinate system in which the cross moment, m11 (cf reference for theory on moment below), is equal to zero. Therefore, this cross forms an angle (theta) with the x axis, and its length in both directions are proportional to the "length" of the shape is that direction.

The Outline Image -- This image contains the outlines of all the regions contained in this image. Again, this can only be generated if this input image is not a grey level image.

The VIFF Image -- The image contains all of the statistics. The VIFF output file has 61 (number of statistics) bands and the number of vectors in this file depends on the number of regions specified in the input image. If the statistics flags are not set, the corresponding statistics will default to zero.

For these three output images there is a final possibility, which is to assign all outlines or crosses a grey level of 255, or their previous region number. This enables the user to visualize the input image, the outline image, and the axis image using pseudo color to assign a different color to each region. This aids in interpreting the regions, and yields an artistic view of the image.

References:

Vision In Man And Machine by Martin D. Levine. Chapter 10. "Shape". Page 480.

Digital Image Processing by R.C. Gonzales & P. Wintz. Chapter "Representation and description". Page 418.

IRE Transactions on information theory,vol IT-8,1962 "Visual Pattern Recognition by Moment Invariants" by Ming_Kuei Hu. Page 179.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

For the x and y representation, x represents the vertical axis and y the horizontal axis. This routine implies a lot of mathematical computation in a direct coordinate system, I didn't use the conventional x and y.

MODIFICATION

Ghosted by Pascal ADAM Fri Jun 15 13:38:24 MDT 1990 Modified vshape to output VIFF file format by Shirley Lee Feb/26/1991.

FILES

$RETRO/objects/library/vipl/src/lvshape.c

SEE ALSO

vipl(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.