preprocessing.glcm_padded
Functions
- glcm_padded
Computes the GLCM of the NDArray bands with padding.
- glcm_padded_cached
Computes the GLCM of the NDArray bands with padding, and caches it.
- append_glcm_padded_cached
Computes the GLCM of the NDArray bands with padding, and caches it and also appends it onto the original array.
Usage
We show a few examples of how to use the GLCM functions.
ar_glcm
is the GLCM of the original array, with the last dimension being the GLCM features. The number of features is determined by thefeatures
parameter, which defaults to all features.ar_glcm_2_features
selects only 2 features, with the last dimension being the 2 GLCM features specified.ar_glcm_cached
caches the GLCM so that if you call it again, it will return the cached version. It stores its data at the project root dir, under.cache/
.ar_glcm_cached_appended
is a wrapper aroundar_glcm_cached
, it appends the GLCM features onto the original array. It's equivalent to callingar_glcm_cached
and thennp.concatenate
on the final axes.
Caching
GLCM is an expensive operation, thus we recommend to cache it if the input parameters will be the same. This is especially useful if you're experimenting with the same dataset with constant parameters.
API
- glcm_padded(ar, bin_from, bin_to, radius, step_size, features)
Computes the GLCM of the NDArray bands with padding.
ar
is the input arraybin_from
is the upper bound of the inputbin_to
is the upper bound of the GLCM input, i.e. the resolution that GLCM operates onradius
is the radius of the GLCMstep_size
is the step size of the GLCMfeatures
is the list of GLCM features to compute
The return shape is
See
glcm_cupy
for the GLCM Features.- glcm_padded_cached(ar, bin_from, bin_to, radius, step_size, features)
Computes the GLCM of the NDArray bands with padding, and caches it.
See
glcm_padded
for the parameters and output shape- append_glcm_padded_cached(ar, bin_from, bin_to, radius, step_size, features)
Computes the GLCM of the NDArray bands with padding, and caches it and also appends it onto the original array.
See
glcm_padded
for the parametersThe return shape is:
The function automatically flattens the last 2 dimensions of the GLCM features, and appends it onto the original array.