How to use gpu.copyTo on the python side

I want to use gpu’s copyTo in python, but there is no Rect class on the python side, which makes it impossible to capture an area from the original image.

You can use a combination of rowRange and colRange, e.g.

>>> src = cv2.cuda.GpuMat(10,10,cv2.CV_8UC1)
>>> src_roi = src.rowRange(5,7).colRange(5,7)
>>> src_roi.setTo(100);
>>> sm = cv2.cuda.GpuMat(2,2,cv2.CV_8UC1)
>>> src_roi.copyTo(sm);
>>> sm.download()
array([[100, 100],
       [100, 100]], dtype=uint8)