|
Main /
Proj1WarpWarps are simply mappings from a source image to a destination images. This mapping takes the form (x',y') = f(x,y)
Where (x',y') describe the position in the destination image. (x,y) is the position in the original image. A non-linear warp means that the function is not linear. There are lots of ideas for non-linear warping. This includes Swirling, Creating waves, Turning an image into a diamond or fisheye warping. Another interesting idea is that you can impose a grid on the source image. The user is allowed to move the points on the grid around, and the image is warped accordingly. This specific warp is interesting because it is the basis on which some morphing systems work (thought not exactly that way). You can find an illustration of this method here (http://freespace.virgin.net/hugo.elias/graphics/x_warp.htm) Implementing non-linear warping requires performing image resampling. The positions of the samples are determined by the warping function. Warping can be done using either one of two methods, the forward method, and the reverse method (or backwards method). For the forward method, we scan the source image pixel by pixel, moving this pixel to its target in the destination image. In the reverse method, we scan the destination image pixel by pixel figuring out where each pixel came from in the source image. Forward warps are hard to implement because we need to find a logical way to fill in the gaps. Therefore, for this project we recommend that you implement reverse warping. Notice that when doing an reverse warping, you need to be able to computer the inverse of the function f. In reverse warping, for each pixel of the target image you sample the source image. The position of this sample is given by the inverse of the warp function. Note that there are two issues that make this sampling difficult:
These issues are similar to resampling for resizing. One way to think of how non-linear warping is harder is that for every pixel, the amount of resizing is different. And those nice, round (or elliptical) gaussian kernels can get warped into wierd shapes. There are many choices in how you implement the resampling. The easiest method would be to point sample and use nearest neighbor interpolation. Better solutions would use interpolation and variable size sampling filters (where the filter kernel changes size depending on the warp). Implementing a variable shape filter kernel is harder.
Note: if you implement a harder version, you should also implement the easier version so that you can show the difference. Here are some examples for nonlinear warps. Starting from this input picture ![]() Here are examples of warps done using point sampling ![]() ![]() Notice the jagged edges in the pictures. This is not always desirable. Using bilinear interpolation instead produces smoother results ![]() ![]() However, notice that the blurriness in the center of the fisheye warp is incorrect. This area should be sharper. We get similar effects using gaussian kernel with fixed radius. ![]() ![]() Finally, here are two examples done using a variable gaussian filter. These were produced using simple isotropic filtering ![]() ![]()
|