Skip to content
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

Open
wants to merge 3 commits into
base: source
Choose a base branch
from
Open

Demo: GLCM matrix #215

wants to merge 3 commits into from

Conversation

ashwani-rathee
Copy link
Member

@ashwani-rathee ashwani-rathee commented Aug 10, 2021

  • Covers GLCM(Gray Level Co-occurence Matrix) of an image

Preview: https://juliaimages.org/previews/PR215/examples/image_features/glcm/#Gray-Level-Co-occurrence-Matrix

Copy link

@kimikage kimikage left a 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 Show resolved Hide resolved
docs/examples/image_features/glcm.jl Outdated Show resolved Hide resolved
Comment on lines 76 to 78
# 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.

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. 🤔

Copy link
Member

@johnnychen94 johnnychen94 left a 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, and maxsize 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 Show resolved Hide resolved
docs/examples/image_features/glcm.jl Outdated Show resolved Hide resolved
Comment on lines 24 to 25
# 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.
Copy link
Member

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).

Copy link
Member

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)

docs/examples/image_features/glcm.jl Outdated Show resolved Hide resolved
docs/examples/image_features/glcm.jl Outdated Show resolved Hide resolved
# 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)
Copy link
Member

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.

Copy link
Member Author

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

@johnnychen94 johnnychen94 added the demo Ideas for demo/example to fulfill our gallery label Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo Ideas for demo/example to fulfill our gallery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants