Ask Your Question
0

Accelerate undistort() with parallelism on GPU

asked 2020-07-23 07:42:32 -0500

jvincent gravatar image

updated 2020-07-23 09:22:47 -0500

berak gravatar image

Dear all,

I'm currently using opencv accelerated functions from cv::cuda.

I also want to use the undistort() function, wich is already parralelised on CPU. However, the use of this function still takes too much time, and I want to compile it for GPU use.

I'm trying to make my own version of this function, but I get stucked with getInitUndistortRectifyMapComputer()

This function is calling itself in undistort.dispatch.cpp :

namespace
{
    Ptr<ParallelLoopBody> getInitUndistortRectifyMapComputer(Size _size, Mat &_map1, Mat &_map2, int _m1type,
                                                             const double *_ir, Matx33d &_matTilt,
                                                             double _u0, double _v0, double _fx, double _fy,
                                                             double _k1, double _k2, double _p1, double _p2,
                                                             double _k3, double _k4, double _k5, double _k6,
                                                             double _s1, double _s2, double _s3, double _s4)
    {
        CV_INSTRUMENT_REGION();

        CV_CPU_DISPATCH(getInitUndistortRectifyMapComputer, (_size, _map1, _map2, _m1type, _ir, _matTilt, _u0, _v0, _fx, _fy, _k1, _k2, _p1, _p2, _k3, _k4, _k5, _k6, _s1, _s2, _s3, _s4),
                        CV_CPU_DISPATCH_MODES_ALL);
    }
} // namespace

I cannot find where the function is implemented.

Also, the study of ParallelLoopBody, parallel_for_ and CV_CPU_DISPATCH led me nowhere

How can I find the source code to compile my own version of the function ??

Is there an other way to get the same result using other (opencv or not) stuff ??

Thanks,

edit retag flag offensive close merge delete

Comments

1 answer

Sort by » oldest newest most voted
0

answered 2020-07-23 07:54:16 -0500

updated 2020-07-23 07:57:56 -0500

Are you trying to find this?

How long does it take on the CPU and how does this compare to the time taken by your other operations?

Does the function have an opencl implementation. Check if UMat is faster than Mat.

edit flag offensive delete link more

Comments

I already use cv::cuda, which contains all the accelerated opencv functions. I tested both UMAt and GpuMat, but GpuMat is more efficient.

but undistort is not accelerated. It takes 1.7 second to calibrate one image, instead the others opérations, even not accelerated, take btwn 200 and 300 ms.

jvincent gravatar imagejvincent ( 2020-07-24 04:10:00 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-07-23 07:42:32 -0500

Seen: 68 times

Last updated: Jul 23