-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demo: GLCM matrix #215
base: source
Are you sure you want to change the base?
Demo: GLCM matrix #215
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your help in improving the documentation.
I don't know much about GLCM, but I just happened to see this, so I leave some trivial comments.
docs/examples/image_features/glcm.jl
Outdated
# The `distances` and `angles` arguments may be a single integer or a vector of | ||
# integers if multiple GLCMs need to be calculated. The `mat_size` argument is used | ||
# to define the granularity of the GLCM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a more specific explanation of what the numbers in angles
mean.
From the keyword "integer", I imagined those numbers to be discretized values in units of 45°, but looking at the source code, they seem to be in radians. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice tutorial, and the similarity plot is quite cool.
Here's the structure I have in mind:
- A background introduction to GLCM matrix with some basic math computation on one tiny array (like the figure shows)
- Some introduction to
ImageFeatures.glcm
; how do we link the math concepts to the arguments. For example,distance
+angle
seems to define the neighbourhood relationship, andmaxsize
defines the matrix size. And how do we calculate the glcm properties. - Some applications on
glcm
, in this demo, you have shown the similarity plot using GLCM, which is pretty cool. And then maybe leave some notes or references for readers that are interested in this topic.
How do you think of this tutorial structure?
docs/examples/image_features/glcm.jl
Outdated
# Each entry of the GLCM[i,j] holds the count of the number of times that pair of | ||
# intensities appears in the image with the defined spatial relationship. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I actually still don't quite understand the contents of GLCM
here. Maybe add more explanation here, for example, why is GLCM[1, 3] == 3
in this case? (I'm using 1-based indexing but this figure seems using 0-based indexing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add this and explain the arguments to glcm
.
X = [0 1 0 2;
0 2 1 1;
3 1 0 0;
0 0 2 3]
glcm(X, 1, 0, 4)
# GLCM matrices. It's easy to notice that the Patch 1 & Patch 2 are closer in the properties | ||
# and similiarly for Patch 3 and Patch 4. | ||
|
||
# ![](assets/scatter.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, is it possible to replace the marker dots with the corresponding patch(image)? That would be the most self-explained way I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be done in Makie.jl but makie keeps crasing in my system for now
Preview: https://juliaimages.org/previews/PR215/examples/image_features/glcm/#Gray-Level-Co-occurrence-Matrix