You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to use linedraw.py get this error. What modifications did you make to linedraw from the original git as I can't see this preserve_tone command in the original linedraw.py what would I need to do if I run the original from here https://github.com/LingDong-/linedraw to make it work with the brachiograph?
Thank you.
python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license"for more information.
>>> from linedraw import *
>>> image_to_json("africa", draw_contours=2, draw_hatch=16)
Traceback (most recent call last):
File "<stdin>", line 1, in<module>
File "/home/pi/BrachioGraph/linedraw.py", line 40, in image_to_json
lines = vectorise(
File "/home/pi/BrachioGraph/linedraw.py", line 129, in vectorise
image = ImageOps.autocontrast(image, 5, preserve_tone=True)
TypeError: autocontrast() got an unexpected keyword argument 'preserve_tone'
Edit: Looked at pillow project found this info
>>> Image.__version__
'8.1.2'
[ImageOps](https://pillow.readthedocs.io/en/stable/reference/ImageOps.html#module-PIL.ImageOps) Module
The [ImageOps](https://pillow.readthedocs.io/en/stable/reference/ImageOps.html#module-PIL.ImageOps) module contains a number of ‘ready-made’ image processing operations. This module is somewhat experimental, and most operators only work on L and RGB images.
New in version 1.1.3.
PIL.ImageOps.autocontrast(image, cutoff=0, ignore=None, mask=None, preserve_tone=False)[[source]](https://pillow.readthedocs.io/en/stable/_modules/PIL/ImageOps.html#autocontrast)
Maximize (normalize) image contrast. This function calculates a histogram of the input image (or mask region), removes cutoff percent of the lightest and darkest pixels from the histogram, and remaps the image so that the darkest pixel becomes black (0), and the lightest becomes white (255).
PARAMETERS:
image – The image to process.
cutoff – The percent to cut off from the histogram on the low and high ends. Either a tuple of (low, high), or a single number for both.
ignore – The background pixel value (use None for no background).
mask – Histogram used in contrast operation is computed using pixels within the mask. If no mask is given the entire image is used for histogram computation.
preserve_tone –
Preserve image tone in Photoshop-like style autocontrast.
New in version 8.2.0.
So I guess maybe it's missing from the default version installed.
The text was updated successfully, but these errors were encountered:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (20.3.4)
Collecting pip
Downloading https://www.piwheels.org/simple/pip/pip-23.1.2-py3-none-any.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 330 kB/s
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.9 are installed in'/home/pi/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.1.2
python3 -m pip install --upgrade Pillow
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (8.1.2)
Collecting Pillow
Downloading Pillow-9.5.0-cp39-cp39-manylinux_2_28_aarch64.whl (3.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 4.0 MB/s eta 0:00:00
Installing collected packages: Pillow
Successfully installed Pillow-9.5.0
Trying to use linedraw.py get this error. What modifications did you make to linedraw from the original git as I can't see this preserve_tone command in the original linedraw.py what would I need to do if I run the original from here https://github.com/LingDong-/linedraw to make it work with the brachiograph?
Thank you.
Edit: Looked at pillow project found this info
So I guess maybe it's missing from the default version installed.
The text was updated successfully, but these errors were encountered: