Skip to content

CUDA GpuMat ConvertTo() error #1034

Closed
Closed
@ccarmatic

Description

@ccarmatic

Expected behaviour

I am using CUDA

I have a Numpy array in np.float16 format, from a greyscale image, with dimensions of HEIGHT and WIDTH
I am trying to scale it with ConvertTo and output it in 8 bit unsigned integer

16fnumpyarray = inputarray.astype(np.float16)
myGpuMat= cv2.cuda.GpuMat(HEIGHT,WIDTH,cv2.CV_16F)
TargetGpuMat= cv2.cuda.GpuMat(HEIGHT,WIDTH,cv2.CV_8U)
scaling = np.random.default_rng()

myGpuMat.upload(16fnumpyarray)

myGpuMat.convertTo(cv2.CV_8U,alpha=scaling,beta=1,dst=TargetGpuMat)

expected behaviour is returning TargetGpuMat successfully

Actual behaviour

actual behaviour is an error code:
cv2.error: Unknown C++ exception from OpenCV code

Steps to reproduce

  • example code : provided above

  • operating system : latest Windows 11

  • architecture : x64

  • opencv-python version : Cudawarped 4.10.0.84 version

  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")

  • I'm using the latest version of opencv-python

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