Have you encountered this problem with functions running on CPUs, such as CV:: remap, which take too long to run?

CV:: remap(), processing a 1920 * 1080 image, the same program runs within 2ms on my laptop, but even takes 30-60ms on orin, which is very strange. Other programs typically take much less time on orin than on laptops.

Have you encountered similar problems?

Looks unexpected…

I’ve just tested the following code:

import numpy as np
import cv2

K = np.asarray([[556.3834638575809,0,955.3259939726225],[0,556.2366649196925,547.3011305411478],[0,0,1]])
D = np.asarray([[-0.05165940570900624],[0.0031093602070252167],[-0.0034036648250202746],[0.0003390345044343793]])
map1, map2 = cv2.fisheye.initUndistortRectifyMap(K, D, np.eye(3), K, (1920, 1080), cv2.CV_32FC1)

cap = cv2.VideoCapture("videotestsrc ! video/x-raw,width=320,height=240,framerate=30/1,format=YUY2 ! nvvidconv ! video/x-raw(memory:NVMM),width=1920,height=1080,framerate=30/1 ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink drop=1", cv2.CAP_GSTREAMER)
if not cap.isOpened():
   print('failed to open video capture')

while True:
   ret_val, img = cap.read();
   if not ret_val:

   startTick = cv2.getTickCount()
   outimg = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT)
   remapTime = (cv2.getTickCount() - startTick)/cv2.getTickFrequency();
   cv2.imshow('Remapped', outimg);	     	
   if cv2.waitKey(1) == ord('q'):

remap takes 9 ms with my AGX Orin running R35.3 with opencv 4.6.0.
Boosting clocks with jetson_clocks script, it takes 5 ms.

For better performance, you may also see How to perform fish-eye lens distortion correction in gstreamer pipeline? (Hfov ~150) - #16 by Honey_Patouceul

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.