Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv cuda Merge returns Numpy array not GpuMat

Hi all, I'm trying to adjust hsv in images with cv2.cuda. while trying when I use cv2.cuda.merge it returns numpy array and not GpuMat type.

my code :

import cv2
import numpy as np

img =  cv2.imread('test.png')
imgMat = cv2.cuda_GpuMat(img)
imgSat = cv2.cuda.cvtColor(imgMat,cv2.COLOR_BGR2HSV)
print("Before Merge type : ",type(imgSat))
h,s,v = cv2.cuda.split(imgSat)
size_s = s.size()
w_s = cv2.cuda_GpuMat(size_s[1],size_s[0], s.type(), [30])
s = cv2.cuda.add(s, w_s)
te = cv2.cuda.merge([h,s,v])
print("After merge type : ",type(te))

Output :

Before Merge type :  <class 'cv2.cuda_GpuMat'>
After merge type :  <class 'numpy.ndarray'>

Anyone facing same scenario?