Usage (GLCM)

Given that ar is an np.ndarray.

OOP GLCM Transform

>>> from glcm_cupy import GLCM
>>> g = GLCM(...).run(ar)

Functional GLCM Transform

>>> from glcm_cupy import glcm
>>> g = glcm(ar, ...)

I/O

For a np.ndarray or cp.ndarray input, the algorithm will output a np.ndarray or cp.ndarray respectively.

Input Array Requirements

  • Shape: \(B\times H\times W\times C\) or \(H\times W\times C\)

  • Non-negative, integer array

  • Must be large enough for radius and step_size

\[\begin{split}B: \text{Batches}\\ H: \text{Height}\\ W: \text{Width}\\ C: \text{Channel}\end{split}\]

Output Array

  • Shape: \(B\times H^*\times W^*\times C\times F\) or \(H\times W\times C\times F\)

  • 0 to 1 if normalize_features, else it depends on feature.

\[\begin{split}H^*: H - (\text{Step Size} + \text{Radius}) \times 2\\ W^*: W - (\text{Step Size} + \text{Radius}) \times 2\\ F: \text{Features}\end{split}\]

Arguments

Argument

Description

Default

directions

List of GLCM.Direction for GLCM to use

(Direction.EAST, Direction....)

features

List of GLCM.Features for GLCM to use

(Features.HOMOGENEITY, Features....)

step_size

Distance between GLCM Windows

1

radius

Radius of GLCM Windows

2

bin_from

Maximum Value + 1 of the array.

256

bin_to

Maximum Value + 1 of the array

256

normalized_features

Whether to scale features to [0, 1]

True

verbose

Whether tqdm outputs progress

True

max_partition_size1

No. of windows parsed per GLCM Matrix

10000

max_threads1

No. of threads per CUDA block

512

See also

Learn how to use glcm-cupy from the examples in the sidebar on the left!


1(1,2)

Recommend to not change.