-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Added documentation for ImageMorph module #9302
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
base: main
Are you sure you want to change the base?
Added documentation for ImageMorph module #9302
Conversation
hugovk
left a comment
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 filling this gap in the docs!
Please can you check the Sphinx warnings?
ImageMorph.rst:13: WARNING: py:class reference target not found: LutBuilder [ref.class]
ImageMorph.rst:13: WARNING: py:class reference target not found: MorphOp [ref.class]
ImageMorph.rst:54: WARNING: py:class reference target not found: LutBuilder [ref.class]
ImageMorph.rst:59: WARNING: py:class reference target not found: LutBuilder [ref.class]
ImageMorph.rst:62: WARNING: py:class reference target not found: LutBuilder [ref.class]
ImageMorph.rst:83: WARNING: py:meth reference target not found: LutBuilder.get_lut [ref.meth]
ImageMorph.rst:83: WARNING: py:meth reference target not found: LutBuilder.load_lut [ref.meth]
ImageMorph.rst:83: WARNING: py:meth reference target not found: LutBuilder.save_lut [ref.meth]
ImageMorph.rst:87: WARNING: py:class reference target not found: MorphOp [ref.class]
ImageMorph.rst:90: WARNING: py:class reference target not found: MorphOp [ref.class]
ImageMorph.rst:90: WARNING: py:meth reference target not found: MorphOp.apply [ref.meth]
ImageMorph.rst:109: WARNING: py:meth reference target not found: MorphOp.match [ref.meth]
ImageMorph.rst:109: WARNING: py:meth reference target not found: MorphOp.get_on_pixels [ref.meth]
ImageMorph.rst:125: WARNING: py:class reference target not found: LutBuilder [ref.class]
ImageMorph.rst:145: WARNING: py:mod reference target not found: _imagingmorph [ref.mod]
ImageMorph.rst:145: WARNING: py:class reference target not found: LutBuilder [ref.class]
ImageMorph.rst:145: WARNING: py:class reference target not found: MorphOp [ref.class]
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
d6a379d to
feb6955
Compare
docs/reference/ImageMorph.rst
Outdated
|
|
||
| * ``1`` — pixel must be “on” | ||
| * ``0`` — pixel must be “off” | ||
| * ``-`` — “don’t care” value (ignored during matching) |
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.
@johnnygitgud considering that our existing documentation says
. or X - Ignore
what made you think that - was the ignore value?
|
|
||
| lb = ImageMorph.LutBuilder(op_name="corner") | ||
| lb.add_patterns(patterns) | ||
| lut = lb.build_lut() |
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 example doesn't work. It fails with
Traceback (most recent call last):
File "demo.py", line 10, in <module>
lut = lb.build_lut()
File "PIL/ImageMorph.py", line 156, in build_lut
raise Exception(msg)
Exception: Syntax error in pattern "10"
It is, for one thing, missing the 4/N/1/M operation. It feels like you haven't read
Lines 51 to 60 in 00e2198
| Operations: | |
| - 4 - 4 way rotation | |
| - N - Negate | |
| - 1 - Dummy op for no other operation (an op must always be given) | |
| - M - Mirroring | |
| Example:: | |
| lb = LutBuilder(patterns = ["4:(... .1. 111)->1"]) |
If you haven't read the source code, that's kind of a red flag with a documentation suggestion.
Could you explain how you came up with this code?
|
Looking at https://pillow--9302.org.readthedocs.build/en/9302/reference/ImageMorph.html, I feel like the initial description duplicates part of the I've created #9349 as an alternative. |
This pull request adds documentation for the ImageMorph module
For issue #713 ("Todo: Docs for ImageMorph").
The updated documentation has: