Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUDA GpuMat ConvertTo() error #1034

Open
2 tasks
ccarmatic opened this issue Sep 30, 2024 · 1 comment
Open
2 tasks

CUDA GpuMat ConvertTo() error #1034

ccarmatic opened this issue Sep 30, 2024 · 1 comment

Comments

@ccarmatic
Copy link

ccarmatic commented Sep 30, 2024

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

@ccarmatic
Copy link
Author

Solved by using fp32 instead of fp16, it looks like this function is not compatible with fp16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant