Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#1,263 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
opencv, python

Research direction

Start by running the provided cv2.applyColorMap snippet with the reported opencv-python 4.x and 5.x versions, then inspect the package or upstream entry point responsible for this behavior. Compare the resulting shape against existing tests or project guidance; done means the version difference is resolved or its intended behavior is clearly documented with regression coverage.

Written by the indexing model from the issue text.

Description

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
Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opencv/opencv-python

All issues in opencv/opencv-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.