captcha.graphics
Class PerspectiveProjection

java.lang.Object
  extended by captcha.graphics.PerspectiveProjection

public class PerspectiveProjection
extends java.lang.Object

This class is the implementation for a perspective projection between two images of the same size (the areas of projection can be chosen within the constructor).


Field Summary
private  Matrix m_projectionMatrix
          Stores the projection matrix needed for the trnasformation of the image pixels.
 
Constructor Summary
PerspectiveProjection(Quadrangle a_orig, Quadrangle a_image)
          Creates a new instance of PerspectiveProjection.
 
Method Summary
 java.awt.Image transform(java.awt.Image a_input, java.awt.Color a_defaultColor)
          Performs the projection between original and image as configured in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_projectionMatrix

private Matrix m_projectionMatrix
Stores the projection matrix needed for the trnasformation of the image pixels.

Constructor Detail

PerspectiveProjection

public PerspectiveProjection(Quadrangle a_orig,
                             Quadrangle a_image)
Creates a new instance of PerspectiveProjection.

Parameters:
a_orig - A quadrangle (needs not to be a rectangle) of coordinates in the original. All points within that quadrangle are projected within the image quadrangle.
a_image - The image quadrangle (needs not to be a rectangle). All pixels within area of the original quadrangle are projected within that image quadrangle (in a new created Image with the same size as the original Image).
Method Detail

transform

public java.awt.Image transform(java.awt.Image a_input,
                                java.awt.Color a_defaultColor)
                         throws java.lang.Exception
Performs the projection between original and image as configured in the constructor. The image of the projection is a new Image with the same size as the original Image. This method should not throw an Exception, but it's possible.

Parameters:
a_input - The original Image.
a_defaultColor - The default color used for every pixel in the image of the projection, which is not the image of a projected original pixel.
Returns:
The image of the projection, which has the same size as the original.
Throws:
java.lang.Exception