Skip to content

cv2.applyColorMap got different result shape between 4.x and 5.x #1263

Description

@ganlvtech
import numpy as np
import cv2

colors = cv2.applyColorMap(np.array([0, 63, 127, 191, 255], dtype=np.uint8), cv2.COLORMAP_PARULA)
print('shape', colors.shape)

opencv-python 4.x got shape (5, 1, 3)

# pip list | grep -e cv -e numpy
numpy                                  2.4.6
opencv-python                          4.13.0.92

Python version 3.11.9

opencv-python 5.x got shape (1, 5, 3)

# pip list | grep -e cv -e numpy
numpy                                  2.4.6
opencv-python                          5.0.0.93


Python version 3.11.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions