+
Skip to content

kmeans_segmentation must be applied only to RGB images (RGBA not allowed) #197

@ernestoarbitrio

Description

@ernestoarbitrio

Considering the scikit image label2rgb signature:

@change_default_value("bg_label", new_value=0, changed_version="0.19")
def label2rgb(label, image=None, colors=None, alpha=0.3,
              bg_label=-1, bg_color=(0, 0, 0), image_alpha=1, kind='overlay'):
    """Return an RGB image where color-coded labels are painted over the image.

    Parameters
    ----------
    label : array, shape (M, N)
        Integer array of labels with the same shape as `image`.
    image : array, shape (M, N, 3), optional
    ...

The image shape cannot be (M, N, X) but only (M, N, 3).

Here the tests failure report:

        for label in labels:
            mask = (label_field == label).nonzero()
            color = image[mask].mean(axis=0)
>           out[mask] = color
E           ValueError: shape mismatch: value array of shape (4,) could not be broadcast to indexing result of shape (324,3)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载