Warps are generally backward mapped, that is for each pixel in the target image the address of the required pixel in the source image is calculated. Usually co-ordinate geometry is used to calculate the source address.
In the Imaging Whiteboard complex number arithmetic is used. The code to calculate the source pixel becomes:
sourceAddress = targetAddress * WarpFactor;
Yup that is the code!
The trick is to calculate the warp factor.
No warp is (1, 0), here the source is equal to the target address.
Zoom becomes (zoom, 0).
Rotation becomes (Cos (radians), Sin (radians))
So zoom and rotate becomes (zoom, 0) * (Cos (radians), Sin (radians))
Once the warp factor is calculated the warp is almost trivial!
If it’s that easy, why not use a three dimensional complex number to perform a time warp on a captured sequence? That could be fun.
Not so fast, according to the laws of mathematics there is no such thing as a 3 dimensional complex number. 2 sure, 4 OK, even 8.
So, use 4 dimensional complex numbers (quaternions) and ignore one dimension. Turns out that will not work either, mathematics is not so easily fooled.
So I could use co-ordinate geometry, which would be horribly slow and complicated. Or just introduce a DVR control, which is what anybody else would do. The DVR control solution would be limited in its functionality i.e. the same time would have to be applied to all pixels in a frame before the image warp.
None of this is very practical as the memory requirements would be prohibitive.
If you really want to know how to do a time warp you should watch this video. TimeWarp
2 Responses to Using complex arithmetic to perform combination warps