Faster cv::remap on arm v7 devices for undistorting images

asked 2012-11-06 15:17:31 -0500

ericc59 gravatar image

I'm working on a native android application targeting arm v7 devices. I'm using cv::initUndistortRectifyMap with an output map type of CV_16SC2 to create my lookup tables, and cv::remap with cv::INTER_NEAREST and cv::BORDER_CONSTANT to undistort the images. It's currently the slowest part of my application, where cv::remap has an average execution time of 37.6 milliseconds for 960x720 resolution images.

Is anyone aware of a faster method of undistorting images? I looked around the opencv source for a NEON optimized version of remap, but wasn't able to find anything.

edit retag flag offensive close merge delete

Comments

Same problem here. I'm considering an attempt to convert the SSE code to NEON. My estimates show that an Open GL ES shader might yield a 50% speedup and a NEON optimization might yield a 40% speedup. Has anyone tried this yet?

ewenger gravatar imageewenger ( 2013-02-06 09:36:09 -0500 )edit

From my experience, rewriting SSE code to NEON is worth trying for several reasons: 1) It's faster to implement and test because you don't have to take care about GPU 2) You already have very optimal SSE routine. All you need is to translate SSE instructions to NEON intrinsics and you're done.

The GPGPU can be faster than NEON in general, but you should be always remember about GPU-CPU synchronization when you want to read the output from GPU. Usually you call glFlush / glFinish before accessing the pixel buffer. Depending on your shared this can cause 1-5ms delay which can be too much for your case.

Personally i have choosen to use NEON for KLT tracking on iOS and i mananged to reach 12ms tracking time for 640x480 frame on iPhone 4S. NEON version is 5x times faster than original.

BloodAxe gravatar imageBloodAxe ( 2013-06-18 07:40:54 -0500 )edit

Hey BloodAxe, I am considering doing similar modifications to the KLT tracking on an Android based device. Could you share your NEON optimized KLT tracking code? I understand if you can't, but it would be greatly appreciated if you could. Thanks!

harmonic gravatar imageharmonic ( 2013-10-12 12:03:05 -0500 )edit