rapidsai / cucim

cuCIM - RAPIDS GPU-accelerated image processing library
https://docs.rapids.ai/api/cucim/stable/
Apache License 2.0
348 stars 60 forks source link

[FEA] add graycomatrix and graycoprops in skimage.feature #530

Open maxbut38 opened 1 year ago

maxbut38 commented 1 year ago

New generation of artificial intelligence (CNN or Classification) for texture analysis use the grey level co-occurence matrix (GLCM) and its features (contrast, dissimilarity, homogeneity, energy,correlation, ASM) for better classification.

Those methods are alreday in skimage.feature. Thus, i would know if it is possible to add to cucim.skimage.feature to make calculations faster.

Hereafter, the code to transform.

glcm = graycomatrix(image, distances=distances, 
            angles=angles, levels=levels,symmetric=False,normed=True)
contrast = graycoprops(glcm, 'contrast')
dissimilarity = graycoprops(glcm, 'dissimilarity')
homogeneity = graycoprops(glcm, 'homogeneity')
energy = graycoprops(glcm, 'energy')
correlation = graycoprops(glcm, 'correlation')
asm = graycoprops(glcm, 'ASM')
features = np.concatenate([contrast, dissimilarity, homogeneity, energy, correlation, asm])
talakhlaif commented 1 year ago

I would like to work on this issue and implement the graycomatrix

monzelr commented 1 year ago

I will help @talakhlaif with the implementation

grlee77 commented 1 year ago

Thank you for volunteering to work on the feature.

I had briefly looked for existing implementations and found these two that are MIT-licensed: https://github.com/Eve-ning/glcm-cupy https://github.com/teamsar/glcmwithcuda

I did not try either one to see what the relative performance was or how close they are to the scikit-image API. If you have experience with either I would be glad to hear about it. The first one is already CuPy based and actually seems to optionally use cuCIM here: https://github.com/Eve-ning/glcm-cupy/blob/master/glcm_cupy/cross/glcm_cross.py#L12