-
-
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?
Conversation
| low-level implementation of morphological lookup table evaluation is handled | ||
| by the C extension module :mod:`_imagingmorph`. Users should interact | ||
| with :class:`LutBuilder` and :class:`MorphOp`, not with the C extension | ||
| directly. |
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.
I'm interested, why did you feel the need to mention _imagingmorph? _imagingft and _imagingmath aren't mentioned in our docs, for precisely the reason you mention here - we don't want users to deal with them directly. How do you think users would discover _imagingmorph in the first place?
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]
| preset names (``"dilation4"``, ``"dilation8"``, ``"erosion4"``, | ||
| ``"erosion8"``, ``"edge"``), or you may define custom patterns. | ||
|
|
||
| Example: creating a LUT for a 2×2 corner detector:: |
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.
| Example: creating a LUT for a 2×2 corner detector:: | |
| For example, creating a LUT for a 2×2 corner detector:: |
|
|
||
| Relationship to `_imagingmorph` | ||
| ------------------------------- | ||
|
|
||
| The :mod:`PIL.ImageMorph` module provides a Python interface, while the | ||
| low-level implementation of morphological lookup table evaluation is handled | ||
| by the C extension module :mod:`_imagingmorph`. Users should interact | ||
| with :class:`LutBuilder` and :class:`MorphOp`, not with the C extension | ||
| directly. |
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.
Yep, let's remove mention of internal details.
| Relationship to `_imagingmorph` | |
| ------------------------------- | |
| The :mod:`PIL.ImageMorph` module provides a Python interface, while the | |
| low-level implementation of morphological lookup table evaluation is handled | |
| by the C extension module :mod:`_imagingmorph`. Users should interact | |
| with :class:`LutBuilder` and :class:`MorphOp`, not with the C extension | |
| directly. |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
| im = Image.open("input.png").convert("L") | ||
|
|
||
| # Built-in 8-connected dilation | ||
| op = ImageMorph.MorphOp(op_name="dilation8") | ||
|
|
||
| count, out = op.apply(im) |
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.
| im = Image.open("input.png").convert("L") | |
| # Built-in 8-connected dilation | |
| op = ImageMorph.MorphOp(op_name="dilation8") | |
| count, out = op.apply(im) | |
| with Image.open("input.png") as im: | |
| im = im.convert("L") | |
| # Built-in 8-connected dilation | |
| op = ImageMorph.MorphOp(op_name="dilation8") | |
| count, out = op.apply(im) |
This pull request adds documentation for the ImageMorph module
For issue #713 ("Todo: Docs for ImageMorph").
The updated documentation has: