Skip to content

ValueError: the input array must have size 3 along channel_axis #1

@csmiguel

Description

@csmiguel

Thanks for this software. I am encountering this issue when scanning some seeds. The sample images work great so I guess it must be an issue related to the color of this particular image.
len

"""
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitor/cli/extract.py", line 153, in single_wrapped
    run_single(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitor/cli/extract.py", line 77, in run_single
    bin_image = segment_image2(image, bg_col=bg_col, k=2)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitor/tools.py", line 63, in segment_image2
    image = skimage.color.rgb2lab(image)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/skimage/_shared/utils.py", line 394, in fixed_func
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/skimage/color/colorconv.py", line 1139, in rgb2lab
    return xyz2lab(rgb2xyz(rgb), illuminant, observer)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/skimage/_shared/utils.py", line 394, in fixed_func
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/skimage/color/colorconv.py", line 746, in rgb2xyz
    arr = _prepare_colorarray(rgb, channel_axis=-1).copy()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/skimage/color/colorconv.py", line 140, in _prepare_colorarray
    raise ValueError(msg)
ValueError: the input array must have size 3 along `channel_axis`, got (819, 1117, 4)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/bin/traitor", line 8, in <module>
    sys.exit(cli())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/traitor/cli/extract.py", line 300, in extract
    list(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tqdm/std.py", line 1178, in __iter__
    for obj in iterable:
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 870, in next
    raise value
ValueError: the input array must have size 3 along `channel_axis`, got (819, 1117, 4)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions