Skip to content

gen_cooc_matrixGenCoocMatrixGenCoocMatrixgen_cooc_matrixgen_cooc_matrix🔗

Short description🔗

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

Signature🔗

gen_cooc_matrix( region Regions, image Image, out image Matrix, integer LdGray, integer Direction )void GenCoocMatrix( const HObject& Regions, const HObject& Image, HObject* Matrix, const HTuple& LdGray, const HTuple& Direction )static void HOperatorSet.GenCoocMatrix( HObject regions, HObject image, out HObject matrix, HTuple ldGray, HTuple direction )def gen_cooc_matrix( regions: HObject, image: HObject, ld_gray: int, direction: int ) -> HObject

Herror gen_cooc_matrix( const Hobject Regions, const Hobject Image, Hobject* Matrix, const Hlong LdGray, const Hlong Direction )

Herror T_gen_cooc_matrix( const Hobject Regions, const Hobject Image, Hobject* Matrix, const Htuple LdGray, const Htuple Direction )

HImage HImage::GenCoocMatrix( const HRegion& Regions, Hlong LdGray, Hlong Direction ) const

HImage HRegion::GenCoocMatrix( const HImage& Image, Hlong LdGray, Hlong Direction ) const

HImage HImage.GenCoocMatrix( HRegion regions, int ldGray, int direction )

HImage HRegion.GenCoocMatrix( HImage image, int ldGray, int direction )

Description🔗

The operator gen_cooc_matrixGenCoocMatrix determines from the input regions how often the gray values \(i\) and \(j\) are located next to each other in a certain direction (00, 4545, 9090, 135135 degrees), stores this number in the co-occurrence matrix at the locations \((i,j)\) and \((j,i)\) (the matrix is symmetrical), and finally scales the matrix with the number of entries. LdGrayldGrayld_gray indicates the number of gray values to be distinguished (namely \(2^{\textrm{LdGray}}\)).

Example: Input image with gray values (scaled with LdGrayldGrayld_gray=2)

 
0 0 3
1 1 2
1 2 3

Co-occurrence matrix (not scaled):

textbf{0:} quad

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

qquad textbf{135:} quad

 
0 1 1 0
1 0 1 1
1 1 0 0
0 1 0 0

qquad textbf{90:} quad

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

qquad textbf{45:} quad

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

Attention🔗

Note that the operator gen_cooc_matrixGenCoocMatrix only considers the given Regionsregionsregions and ignores any previously set domain of the input image Imageimageimage.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

Parameters🔗

Regionsregionsregions (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region to be checked.

Imageimageimage (input_object) singlechannelimage → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)

Image providing the gray values.

Matrixmatrixmatrix (output_object) image(-array) → object (real)HObject (real)HImage (real)HObject (real)Hobject * (real)

Co-occurrence matrix (matrices).

LdGrayldGrayld_gray (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of gray values to be distinguished (\(2^{\textrm{LdGray}}\)).

Default: 66
List of values: 1, 2, 3, 4, 5, 6, 7, 81, 2, 3, 4, 5, 6, 7, 8
Value range: LdGray (lin)
Minimum increment: 1
Recommended increment: 1

Directiondirectiondirection (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Direction of neighbor relation.

Default: 00
List of values: 0, 45, 90, 1350, 45, 90, 135

Result🔗

The operator gen_cooc_matrixGenCoocMatrix returns the value 2 (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 is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

draw_regionDrawRegion, gen_circleGenCircle, gen_ellipseGenEllipse, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, thresholdThreshold, erosion_circleErosionCircle, binomial_filterBinomialFilter, gauss_filterGaussFilter, smooth_imageSmoothImage, sub_imageSubImage

Alternatives

cooc_feature_imageCoocFeatureImage

See also

cooc_feature_matrixCoocFeatureMatrix

Module🔗

Foundation