Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm trying to crop Image using cv2.cuda and I tried cuda_gpumat.adjustroi()

Hi all,

I'm trying to crop image using cv2.cuda. I done crop with cv2.UMat

With UMat

cropped = cv2.UMat(p, [minX, maxX], [minY, maxY])

With cv2.cuda_gpumat.adjustroi()

cropped = p.adjustROI(minX, maxX, minY, maxY)

My Code :

import cv2

#im=cv2.imread('Remap.png')
im = (1024,1024,3)
print(im.shape)
a=(im.shape[0]*2,im.shape[1]*2)
gpu = cv2.cuda_GpuMat()
gpu.upload(im)

b=cv2.cuda.resize(gpu,a)
print(b.size())
maxX=500
maxY=500
minX = 500
minY= 500
b.adjustROI(maxY,minY, minX, maxX)
print("Adjust ROI : ",b.size())
cropped = cv2.UMat(a, [minX, maxX], [minY, maxY])
print("Umat : ",cropped.size())