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_glcmis the GLCM of the original array, with the last dimension being the GLCM features. The number of features is determined by thefeaturesparameter, which defaults to all features.ar_glcm_2_featuresselects only 2 features, with the last dimension being the 2 GLCM features specified.ar_glcm_cachedcaches 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_appendedis a wrapper aroundar_glcm_cached, it appends the GLCM features onto the original array. It's equivalent to callingar_glcm_cachedand thennp.concatenateon 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.
aris the input arraybin_fromis the upper bound of the inputbin_tois the upper bound of the GLCM input, i.e. the resolution that GLCM operates onradiusis the radius of the GLCMstep_sizeis the step size of the GLCMfeaturesis the list of GLCM features to compute
The return shape is
See
glcm_cupyfor 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_paddedfor 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_paddedfor the parametersThe return shape is:
The function automatically flattens the last 2 dimensions of the GLCM features, and appends it onto the original array.