Facemorph
Class Transformer_1

java.lang.Object
  extended by Facemorph.Transformer_1

public class Transformer_1
extends java.lang.Object

Class to perform prototype (average) based transformations on images.


Constructor Summary
Transformer_1()
           
 
Method Summary
static java.awt.Image averageImages(java.awt.Image[] images, Template[] templates, Template averageTemplate, int outW, int outH, java.awt.image.ImageObserver obs, boolean autoSize)
          Method to create an average from a set of delineated images.
static java.awt.Image averageImagesTexture(java.awt.Image[] images, Template[] templates, Template averageTemplate, int outW, int outH, java.awt.image.ImageObserver obs, boolean autoSize)
          Method to create an average from a set of delineated images.
static java.awt.image.BufferedImage ImageToBufferedImage(java.awt.Image img, java.awt.image.ImageObserver iob)
          Converts an abstract (unknown type of) Image to a BufferedImage for extra functionality.
static void main(java.lang.String[] args)
           
static java.util.Vector<java.awt.Image> morph(java.awt.Image img1, Template tmp1, java.awt.Image img2, Template tmp2, int steps, java.awt.image.ImageObserver ob)
          Creates a Morph between two delineated images
static java.awt.Image transform(Template subjectTemplate, Template sourceTemplate, Template destTemplate, Template newTemplate, java.awt.Image subjectImg, java.awt.Image sourceImg, java.awt.Image destImg, double s, java.awt.image.ImageObserver ob)
          Transforms subjectImage using the prototypes given and returns the result.
static java.awt.Image transformMasked(Template subjectTemplate, Template sourceTemplate, Template destTemplate, Template newTemplate, java.awt.Image subjectImg, java.awt.Image sourceImg, java.awt.Image destImg, double s, java.awt.image.ImageObserver ob, Mask mask)
          Transforms subjectImage using the prototypes given and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transformer_1

public Transformer_1()
Method Detail

transform

public static java.awt.Image transform(Template subjectTemplate,
                                       Template sourceTemplate,
                                       Template destTemplate,
                                       Template newTemplate,
                                       java.awt.Image subjectImg,
                                       java.awt.Image sourceImg,
                                       java.awt.Image destImg,
                                       double s,
                                       java.awt.image.ImageObserver ob)
Transforms subjectImage using the prototypes given and returns the result. The transformed Template is returned in newTemplate. The transformation follows the formula: new = subject + s*(dest-source)

Parameters:
subjectTemplate - The Template outlining the features of subjectImg
sourceTemplate - The (average) Template outlining the features of sourceImg
destTemplate - The (average) Template outlining the features of destImg
newTemplate - Template to hold the Template corresponding to the transformed result. Useful for morphing afterwards.
subjectImg - The Image to transform
sourceImg - The (average) image of the source group
destImg - The (average) image of the destination group
s - The amount to scale this transform by. 0 = no transform, 1= complete transform.
ob - An ImageObserver used for obtaining Image sizes
Returns:
The transformed image.

transformMasked

public static java.awt.Image transformMasked(Template subjectTemplate,
                                             Template sourceTemplate,
                                             Template destTemplate,
                                             Template newTemplate,
                                             java.awt.Image subjectImg,
                                             java.awt.Image sourceImg,
                                             java.awt.Image destImg,
                                             double s,
                                             java.awt.image.ImageObserver ob,
                                             Mask mask)
Transforms subjectImage using the prototypes given and returns the result. The transformed Template is returned in newTemplate. The transformation follows the formula: new = subject + s*(dest-source)

Parameters:
mask - The Mask object defining the boundary of the masked region.
subjectTemplate - The Template outlining the features of subjectImg
sourceTemplate - The (average) Template outlining the features of sourceImg
destTemplate - The (average) Template outlining the features of destImg
newTemplate - Template to hold the Template corresponding to the transformed result. Useful for morphing afterwards.
subjectImg - The Image to transform
sourceImg - The (average) image of the source group
destImg - The (average) image of the destination group
s - The amount to scale this transform by. 0 = no transform, 1= complete transform.
ob - An ImageObserver used for obtaining Image sizes
Returns:
The transformed image.

morph

public static java.util.Vector<java.awt.Image> morph(java.awt.Image img1,
                                                     Template tmp1,
                                                     java.awt.Image img2,
                                                     Template tmp2,
                                                     int steps,
                                                     java.awt.image.ImageObserver ob)
Creates a Morph between two delineated images

Parameters:
img1 - The image to start from
tmp1 - The Template outlining the features of img1
img2 - The image to end at
tmp2 - The template outlining the features of img2
steps - The number of steps between the images i.e. the output list will contain steps+1 images
ob - AN ImageObserver, used for finding Image dimensions
Returns:
A Vector of Image objects representing the morph, includes the start and end points.

averageImages

public static java.awt.Image averageImages(java.awt.Image[] images,
                                           Template[] templates,
                                           Template averageTemplate,
                                           int outW,
                                           int outH,
                                           java.awt.image.ImageObserver obs,
                                           boolean autoSize)
Method to create an average from a set of delineated images.

Parameters:
images - The array of images to be averaged.
templates - The array of templates outlining the features of the corresponding templates.
averageTemplate - The template in which the average shape description will be placed.
outW - The desired width of the output image.
outH - The desired height of the output image.
obs - An image observer used for getting the height and width of the image
autoSize -
Returns:
An int array of pixel values representing the average image.

averageImagesTexture

public static java.awt.Image averageImagesTexture(java.awt.Image[] images,
                                                  Template[] templates,
                                                  Template averageTemplate,
                                                  int outW,
                                                  int outH,
                                                  java.awt.image.ImageObserver obs,
                                                  boolean autoSize)
Method to create an average from a set of delineated images.

Parameters:
images - The array of images to be averaged.
templates - The array of templates outlining the features of the corresponding templates.
averageTemplate - The template in which the average shape description will be placed.
outW - The desired width of the output image.
outH - The desired height of the output image.
obs - An image observer used for getting the height and width of the image
autoSize -
Returns:
An int array of pixel values representing the average image.

ImageToBufferedImage

public static java.awt.image.BufferedImage ImageToBufferedImage(java.awt.Image img,
                                                                java.awt.image.ImageObserver iob)
Converts an abstract (unknown type of) Image to a BufferedImage for extra functionality.

Parameters:
img - The image to convert
iob - An image observer (for getting the image size etc)
Returns:
The Image as a BufferedImage

main

public static void main(java.lang.String[] args)
Parameters:
args -