Project Description:
build a warping tool based on projective warps, which includes all of the affine and perspective warps. The tool will provide for input of a sequence of operations, will compose a single transform from the sequence, and finally will apply the transform to the input image via inverse mapping.You need to consider constructing each of the projective transformations: translate, rotate, scale, flip, shear, and perspective.
The specifications for each transform follow. Your program should loop, reading these until the d command is input). Italics indicate floating point arguments, except for the f command, which takes integer arguments:
r θ counter clockwise rotation about image origin, θ in degrees
s sx sy scale (watch out for scale by 0!)
t dx dy translate
f xf yf flip -if xf=1 flip x coordinates, yf=1 flip ycoordinates
h hx hy shear
p px py perspective
d done
Matrix 3*3
Some Key Points:
1.Forward Mapping will cause gaps(because the image maybe larger than previous one, so some of points will no value )
2.use inverse transform.We can adjust the loop so that we do one copy for each output pixel instead of each input pixel,then we could you different interpolation ways.
Artifacts two types:
a.Aliasing: sampling the input image too coarsely. Occurs
when the image is being minified!
b.Reconstruction: using too crude a method (i.e. the psf) to
reconstruct a pixel. Occurs when the image is magnified.
Perspective Warping
This form of warping stretches and squishes in different places.
Straight lines stay straight, but not necessarily parallel.
Example:
Result example: