1 | initial version |
First, stop using the old API and IplImages if you can.
Second, you can create a two channel float image to use with remap. It should be the size of your destination. The first channel contains the x location in the source image, and the second channel the y location. For example, in your images the numbers in the map for (0,0) would seem to be about (100,50). That means that pixel (100,50) will be placed into the destination image at (0,0), with whatever interpolation you choose for remap.
Do the distortion for every pixel in the image, and save the map to re-use with every frame. The convertMaps function can compress the map to save you memory, if that's a problem.