Upload from Mat to GpuMat is too slow in NX with OpenCV

When I upload two pictures(both are 1920x1080) from Mat to GpuMat, I run twice and it takes an average of 50 ms per picture in the second time! Could someone tell me this is normal or what’s wrong. If somebody helps me I will be very gratefull.

Device: Jetson Xavier NX
OpenCV version: 4.5.2
CUDA version : 10.2
There’s the code for example :

General note applicable to these forums and other online communities: Post code, not pictures of code.

Questions about Jetson platforms usually receive better/faster responses in the sub-forums dedicated to them. In this case: Latest Jetson & Embedded Systems/Jetson Xavier NX topics - NVIDIA Developer Forums

I think the first thing you would want to do is determine the “speed of light”-performance. Presumably assigning a Mat to a GpuMat involves copying the data? Combine the relevant HW bandwidth with the size of each picture to compute how fast it could be copied in the theoretical case scenario.

Thanks for your advice, njuffa. I would try that.