Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv cuda python remap error cv.cuda.remap(raw, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY)

I have installed opencv '4.2.0 dev' ,an already built package from https://jamesbowley.co.uk/accelerate-opencv-4-2-0-build-with-cuda-and-python-bindings/ (https://jamesbowley.co.uk/downloads/).I'm trying to use cv2.cuda.remap but it's throwing error as below

cv.cuda.remap(raw, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY) TypeError: Expected Ptr<cv::umat> for argument 'src' my code

''' import numpy

import cv2 as cv

import numpy as np

npTmp = np.random.random((1024, 1024)).astype(np.float32)

npMat1 = np.stack([npTmp,npTmp],axis=2)

raw= cv.cuda_GpuMat()

raw.upload(npMat1)

a=np.array()

mapx = numpy.ndarray(shape=(640, 480, 1), dtype='float32')

mapy = numpy.ndarray(shape=(640, 480, 1), dtype='float32')

cv.cuda.remap(raw,a, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY) '''

Opencv cuda python remap error cv.cuda.remap(raw, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY)

I have installed opencv '4.2.0 dev' ,an already built package from https://jamesbowley.co.uk/accelerate-opencv-4-2-0-build-with-cuda-and-python-bindings/ (https://jamesbowley.co.uk/downloads/).I'm trying to use cv2.cuda.remap but it's throwing error as below

cv.cuda.remap(raw, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY) TypeError: Expected Ptr<cv::umat> for argument 'src' my codecode:

'''

import numpy

numpy

import cv2 as cv

cv

import numpy as np

np

npTmp = np.random.random((1024, 1024)).astype(np.float32)

1024)).astype(np.float32)

npMat1 = np.stack([npTmp,npTmp],axis=2)

np.stack([npTmp,npTmp],axis=2) raw= cv.cuda_GpuMat()

raw= cv.cuda_GpuMat()

raw.upload(npMat1) a=np.array()

raw.upload(npMat1)

a=np.array()

mapx = numpy.ndarray(shape=(640, 480, 1), dtype='float32')

dtype='float32')

mapy = numpy.ndarray(shape=(640, 480, 1), dtype='float32')

dtype='float32')

cv.cuda.remap(raw,a, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY) '''

Opencv cuda python remap error cv.cuda.remap(raw, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY)

I have installed opencv '4.2.0 dev' ,an already built package from https://jamesbowley.co.uk/accelerate-opencv-4-2-0-build-with-cuda-and-python-bindings/ (https://jamesbowley.co.uk/downloads/).I'm trying to use cv2.cuda.remap but it's throwing error as belowbelow:

cv.cuda.remap(raw, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY)

TypeError: Expected Ptr<cv::umat> for argument 'src' my code:

import numpy

import cv2 as cv

import numpy as np

npTmp = np.random.random((1024, 1024)).astype(np.float32)

npMat1 = np.stack([npTmp,npTmp],axis=2)

raw= cv.cuda_GpuMat()

raw.upload(npMat1)

a=np.array()

mapx = numpy.ndarray(shape=(640, 480, 1),
                           dtype='float32')

mapy = numpy.ndarray(shape=(640, 480, 1),
                           dtype='float32')

cv.cuda.remap(raw,a, mapx, mapy, cv.INTER_CUBIC, borderMode=cv.COLOR_RGB2GRAY)