Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect angle direction descriptions in the graycomatrix function documentation. The original documentation incorrectly described angle directions in mathematical coordinates instead of image coordinates (where rows increase downward).
Key Changes:
- Clarifies that angles are measured counter-clockwise from the positive x-axis
- Corrects angle descriptions for image coordinates where rows increase downward
- Adds explicit examples showing that π/4 radians refers to the bottom-right diagonal neighbor (not top-right) and π/2 radians refers to the pixel below (not above)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3e957a3 to
1e8252c
Compare
| pi/4 radians to the top-right diagonal neighbor; pi/2 radians to the pixel | ||
| above, and so forth. | ||
| Compute 4 GLCMs using 1-pixel distance and 4 different angles. Angles are | ||
| measured counter-clockwise from the positive x-axis (horizontal right). |
There was a problem hiding this comment.
If really there is a mistake and what's below (lines 82--85) is right, then the above sentence isn't helpful at all---it's misleading. I'm tempted to just close this PR, which didn't link to any issue and didn't provide any description.
|
@samay2504 Please provide some code to show the problem that the doc change is meant to address. |
|
I've now done a test and can confirm that the documentation is wrong. @matthew-brett this will may be affected by the xy/ij transformation. Here's the test: Each row of this result is As you can see, with an angle of pi/2, the matches found are all diagonal and downward. I also suggest the following patch to clarify that diff --git a/doc/tools/gitwash b/doc/tools/gitwash
--- a/doc/tools/gitwash
+++ b/doc/tools/gitwash
@@ -1 +1 @@
-Subproject commit 06d130ab98d78e5a831b32a6624cad2bc481cacd
+Subproject commit 06d130ab98d78e5a831b32a6624cad2bc481cacd-dirty
diff --git a/src/skimage/feature/texture.py b/src/skimage/feature/texture.py
index 200aca450..84c6ea259 100644
--- a/src/skimage/feature/texture.py
+++ b/src/skimage/feature/texture.py
@@ -19,7 +19,7 @@ def graycomatrix(image, distances, angles, levels=None, symmetric=False, normed=
grayscale values at a given offset over an image.
.. versionchanged:: 0.19
- `greymatrix` was renamed to `graymatrix` in 0.19.
+ `greycomatrix` was renamed to `graycomatrix` in 0.19.
Parameters
----------
@@ -39,25 +39,26 @@ def graycomatrix(image, distances, angles, levels=None, symmetric=False, normed=
be preferable to use binning of the input image rather than
large values for `levels`.
symmetric : bool, optional
- If True, the output matrix `P[:, :, d, theta]` is symmetric. This
- is accomplished by ignoring the order of value pairs, so both
- (i, j) and (j, i) are accumulated when (i, j) is encountered
- for a given offset. The default is False.
+ If True, the output matrix `P[:, :, d_idx, theta_idx]` is
+ symmetric. This is accomplished by ignoring the order of value
+ pairs, so both (i, j) and (j, i) are accumulated when (i, j)
+ is encountered for a given offset. The default is False.
normed : bool, optional
- If True, normalize each matrix `P[:, :, d, theta]` by dividing
- by the total number of accumulated co-occurrences for the given
- offset. The elements of the resulting matrix sum to 1. The
- default is False.
+ If True, normalize each matrix `P[:, :, d_idx, theta_idx]` by
+ dividing by the total number of accumulated co-occurrences for
+ the given offset. The elements of the resulting matrix sum to
+ 1. The default is False.
Returns
-------
P : 4-D ndarray
The gray-level co-occurrence histogram. The value
- `P[i,j,d,theta]` is the number of times that gray-level `j`
- occurs at a distance `d` and at an angle `theta` from
- gray-level `i`. If `normed` is `False`, the output is of
- type uint32, otherwise it is float64. The dimensions are:
- levels x levels x number of distances x number of angles.
+ `P[i,j,d_idx,theta_idx]` is the number of times that
+ gray-level `j` occurs at a distance `distances[d_idx]` and at
+ an angle `angles[theta_idx]` from gray-level `i`. If `normed`
+ is `False`, the output is of type uint32, otherwise it is
+ float64. The dimensions are: levels x levels x number of
+ distances x number of angles.
References
---------- |
|
Didn't spot the issue in the title there: this closes #7919 |
|
Hello scikit-image core devs! There hasn't been any activity on this PR for more than 180 days. I have marked it as "dormant" to make it easy to find. To our contributors, thank you for your contribution and apologies if this contribution fell through the cracks! Hopefully this ping will help bring some fresh attention to the review. If you need help, you can always reach out on our forum If you think that this PR is no longer relevant, you may close it, or we may do it at some point (either way, it will be done manually). If you think the PR is valuable but you no longer have the bandwidth to update it, please let us know, so that someone can take it over. 🙏 |
From: scikit-image#7980 - the filter is redundant because we're already using pytest.warns for these.
|
We have changed the base branch for this PR from the Summary - what this means for your PRYou can continue to work on your PR, now based on Once we've merged your PR into the Read on for the rationale, and more detailed instructions. DetailsRationaleWe've changed the base branch to make it easier and smoother to continue to work on your PR, while we work through a rather large change in the directory structure of the repository - a change that we have called Megamove. See the Megamove explanation issue for more detail. Changing the base branch means you do not see merge conflicts related to the Megamove change, and can continue to work with the repository in its original state, without worrying about porting those changes across to the new post-Megamove structure. As you'll see in the linked issue, you can continue to work on your PR as before, and you can continue to use the Github GUI to "Update branch" - this updates from the new To emphasize again, do not try and merge the scikit-image When we've approved your PR, we'll merge into the Any questions, please reply here. |
Description
Checklist
./doc/examplesfor new featuresRelease note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.