Skip to content

cv2.cvtColor does not work with single pixel in OpenCV 4.5.4-dev #20968

@froanas

Description

@froanas
System information (version)
  • OpenCV => 4.5.4-dev
  • Operating System / Platform => Windows 64 Bit
  • Compiler => precompiled from opencv-contrib-python-headless 4.5.4.58
Detailed description

Issue encountered in python: opencv/opencv-python#575
cvtColor should be able to convert a single pixel's color as it does in version 4.5.3

Steps to reproduce
import cv2
import numpy as np

pixel = np.uint8([[[40, 50, 200]]])
new_pixel = cv2.cvtColor(pixel, cv2.COLOR_RGB2BGR)
print(new_pixel)

with OpenCV 4.5.3, this runs successfully. With OpenCV 4.5.4-dev, I get the following error:
OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\core\src\matrix.cpp:466: error: (-215:Assertion failed) _step >= minstep in function 'cv::Mat::Mat'

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions