Is there a way to crop an image with gpu

Hello everyone

I am trying to use opencv cuda python but I can’t find if it’s possible to crop an image so using gpu
Cv2.cuda.crop or so , as well if it’s possible to draw rectangles on the image using gpu some like cv3.cuda.rectange() .

Thanks!!!

Hi,
We have hardware engine for cropping an image and it is implemented as nvvidconv plugin in gstreamer. Please refer to the sample:
Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL

And also you may consider to run a gstreamer pipeline and apply cuda filters. Please take a look at the sample:
Nano not using GPU with gstreamer/python. Slow FPS, dropped frames - #8 by DaneLLL

yeah but you can just crop at the beginning of the script when you are reading the file
“gst-launch-1.0 filesrc location=<filename_1080p.mp4> ! qtdemux !
h264parse ! omxh264dec ! nvvidconv left=400 right=1520 top=200
bottom=880 ! nvoverlaysink display-id=1 –e”

I would like to know if its possible to crop in different regions on some frames like
image[200:210, 300:310] but using cuda.

Hi,
For more flexibility we suggest use jetson_multimdia_api. So that we can utilize NvBuffer APIs to get CUDA pointer and map to cv::gpuMat. May refer to this patch:
LibArgus EGLStream to nvivafilter - #7 by DaneLLL

However, it is C code only and does not work in python. This may not fit your requirement.