warpPerspective can be split in two functions (Feature #1564)


Added by vasile v about 13 years ago. Updated over 9 years ago.


Status:Open Start date:
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:imgproc, video
Target version:-
Difficulty: Pull request:

Description

I have been using with great success a split warpPerspective() function to perform all kind of transforms that can be applied to many files at once.

If you precalculate the maps for remap(), you can apply them to many images (by example to a video when processing), gaining a significant performance improvement. Some examples include: fast resize, fast perspective correction, etc.

The technique can be used also on tracking algorithms, or multi-scale detectors on video, where the image must be resized.

The improvement can be achieved by splitting warpPerspective in two functions, that can be called separately from API:
buildMaps() and remap(). (The latter is already separate)

Example:

 1VideoCapture cap;
 2cap.open(file);
 3Mat H = (Mat_<float>( 0.5, 0, 0, 0, 0,5, 0, 0, 0,0, 0));
 4builsMaps(srcsize, dstsize, H, mapx, mapy);
 5
 6Mat frame, smallframe;
 7
 8for(;;)
 9{
10   cap >> frame;
11
12   // much, much faster than resize or warpAffine
13   remap(frame, smallframe, mapx, mapy, flags); 
14}

A good idea would be to have a separate optimization for remap on android (now it has only SSE acceleration)


Associated revisions

Revision 46eeb106
Added by Roman Donchenko over 11 years ago

Merge pull request #1564 from alalek:cl_runtime_fix_32bit

History

Updated by Alexander Shishkov about 13 years ago

  • Description changed from I have been using with great succes a split warpPerspective() function to per... to I have been using with great succes a split warpPerspective() function to per... More

Updated by Andrey Kamaev about 13 years ago

  • Description changed from I have been using with great succes a split warpPerspective() function to per... to I have been using with great success a split @warpPerspective()@ function to ... More

Updated by Vadim Pisarevsky almost 13 years ago

  • Priority changed from High to Normal

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4324

Also available in: Atom PDF