speed up remap with different maps per color channel

asked 2016-04-26 12:32:00 -0600

benT gravatar image

Hi, I am trying to display a camera stream on my android device with a distortion so I can look at it through a Zeiss VR One. For the distortion, I took the lookup tables from the Zeiss VR SDK, as described in this question: http://answers.opencv.org/question/93...

Now I am facing the next issue. There are 6 LUTs, one for each color channel and one for the x and y axes, so I have to split the channels, call remap once per channel and then merge the channels again. This is extremely slow and I would like to speed it up by implementing remap to take in all 6 LUTs, then start a thread per channel. The Threads would then all take the same Mat as an Input and read from that Mat, apply the remap with the LUT according to the channel they are treating, and then write the result the same Mat as the other Threads.

This would avoid the copying from split and divide the remap calls into 3 Threads, so I hope it can improve performance and get my FPS up.

My problem is that I cannot find the source code for the original remap function. I can only find opencl_kernels_imgproc.cpp that seems to have some kind of implementation but I do not know OpenCL.

Did anyone ever implement such an approach? Do you think I will notice a performance improvement?

edit retag flag offensive close merge delete

Comments

I ended up doing the remap with Unity, but I am leaving this question here, maybe someone someday is going to answer it.

benT gravatar imagebenT ( 2016-10-18 11:08:54 -0600 )edit