Herror ::gen_cooc_matrix (
    Hobject Regions,
    Hobject Image,
    Hobject *Matrix,
    const HTuple &LdGray,
    const HTuple &Direction
)
HImage HRegion::GenCoocMatrix (
    const HImage &Image,
    const HTuple &LdGray,
    const HTuple &Direction
) const
HImageArray HRegionArray::GenCoocMatrix (
    const HImage &Image,
    const HTuple &LdGray,
    const HTuple &Direction
) const

Calculate the co-occurrence matrix of a region in an image.

The operator ::gen_cooc_matrix determines from the input regions how often the gray values i and j are located next to each other in a certain direction (0, 45, 90, 135 degrees), stores this number in the co-occurrence matrix at the locations (i,j) and (j,i) (the matrix is symmetrical), and finally scalse the matrix with the number of entries. LdGray indicates the number of gray values to be distinguished (namely 2^LdGray).

Example (LdGray = 2, i.e. 4 gray values are distinguished):

	  Input image with gray values:     0 0 3
					    1 1 2
					    1 2 3

	  Co-occurrence matrix (not scaled):

		  2 0 0 1         0 1 1 0
		  0 2 2 0         1 0 1 1
		  0 2 0 1         1 1 0 0
		  1 0 1 0         0 1 0 0

		  0 2 0 0         0 1 0 0
		  2 2 1 0         1 2 0 1
		  0 1 0 2         0 0 2 0
		  0 0 2 0         0 1 0 0
 


Parameters

Regions (input_object)
region(-array) -> Hobject: HRegion(Array)
Region to be checked.

Image (input_object)
image -> Hobject: HImage ( byte )
Image providing the gray values.

Matrix (output_object)
image(-array) -> Hobject * : HImage(Array) ( int4 )
Co-occurrence matrix (matrices).

LdGray (input_control)
integer -> HTuple.long
Number of gray values to be distinguished (2^LdGray).
Default value: 6
List of values: 1, 2, 3, 4, 5, 6, 7, 8
Typical range of values: 1 <= LdGray <= 256 (lin)
Minimum increment: 1
Recommended increment: 1

Direction (input_control)
integer -> HTuple.long
Direction of neighbor relation.
Default value: 0
List of values: 0, 45, 90, 135


Result

The operator ::gen_cooc_matrix returns the value H_MSG_TRUE if an image with defined gray values is entered and the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator ::set_system('no_object_result',<Result>), the behavior in case of empty region is set via ::set_system('empty_region_result',<Result>). If necessary an exception handling is raised.


Possible Predecessors

::draw_region, ::gen_circle, ::gen_ellipse, ::gen_rectangle1, ::gen_rectangle2, ::threshold, ::erosion_circle, ::gauss_image, ::smooth_image, ::sub_image


Alternatives

::cooc_feature_image


See also

::cooc_feature_matrix


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH