Facemorph.glmorph
Class IO

java.lang.Object
  extended by Facemorph.glmorph.IO

public class IO
extends java.lang.Object

IO holds data for image morph and transforming i.e. image, template and triangulation


Field Summary
protected  java.awt.image.BufferedImage bpicture
          the image as a BufferedImage
protected  int numTriangles
          Number of triangles
protected  int numVertex
          Number of vertices
protected  java.awt.Image picture
          The image
protected  int pictureHeight
          the height of the image
protected  int pictureWidth
          The width of the image
protected  Template temp
          The Template
protected  float[] textureX
          x texture coord
protected  float[] textureY
          y texture coord
protected  int[][] triangles
          triangulation data
protected  float[] vertexX
          x vertex
protected  float[] vertexY
          y vertex
 
Constructor Summary
IO(java.awt.Component hm)
          Constructor that takes a component
 
Method Summary
static boolean hasAlpha(java.awt.Image image)
          This method returns true if the specified image has transparent pixels
 void loadImage(java.net.URL url)
          Load the image from a URL
 void loadTemplate(java.net.URL url)
          Load the Template from a URL
 java.awt.Image resizeImage(java.awt.Image img, int w, int h)
          Resize the image
 void setImage(java.awt.Image img)
          Set the image
 void setTemplate(Template temp)
          Set the Template
 void stripTriangles()
          Strip triangles that lie outside the image
static java.awt.image.BufferedImage toBufferedImage(java.awt.Image image)
          This method returns a buffered image with the contents of an image
static java.nio.FloatBuffer toFloatImage(java.awt.image.BufferedImage bimg)
          Convert an image to a FloatBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

picture

protected java.awt.Image picture
The image


bpicture

protected java.awt.image.BufferedImage bpicture
the image as a BufferedImage


temp

protected Template temp
The Template


pictureWidth

protected int pictureWidth
The width of the image


pictureHeight

protected int pictureHeight
the height of the image


textureX

protected float[] textureX
x texture coord


textureY

protected float[] textureY
y texture coord


vertexX

protected float[] vertexX
x vertex


vertexY

protected float[] vertexY
y vertex


numTriangles

protected int numTriangles
Number of triangles


numVertex

protected int numVertex
Number of vertices


triangles

protected int[][] triangles
triangulation data

Constructor Detail

IO

public IO(java.awt.Component hm)
Constructor that takes a component

Parameters:
hm - the component to use
Method Detail

setTemplate

public void setTemplate(Template temp)
Set the Template

Parameters:
temp - the template

loadTemplate

public void loadTemplate(java.net.URL url)
                  throws java.io.IOException
Load the Template from a URL

Parameters:
url - the URL to load from
Throws:
java.io.IOException

setImage

public void setImage(java.awt.Image img)
Set the image

Parameters:
img - the image

loadImage

public void loadImage(java.net.URL url)
Load the image from a URL

Parameters:
url - the URL of the image

resizeImage

public java.awt.Image resizeImage(java.awt.Image img,
                                  int w,
                                  int h)
Resize the image

Parameters:
img - the image
w - the new width
h - the new height
Returns:
returns the resized image

toFloatImage

public static java.nio.FloatBuffer toFloatImage(java.awt.image.BufferedImage bimg)
Convert an image to a FloatBuffer

Parameters:
bimg - the image to convert
Returns:
returns the image as a FloatBuffer

toBufferedImage

public static java.awt.image.BufferedImage toBufferedImage(java.awt.Image image)
This method returns a buffered image with the contents of an image

Parameters:
image - the input image
Returns:
returns the image as a BufferedImage

hasAlpha

public static boolean hasAlpha(java.awt.Image image)
This method returns true if the specified image has transparent pixels

Parameters:
image - the image to check
Returns:
returns true if it has transparent pixels

stripTriangles

public void stripTriangles()
Strip triangles that lie outside the image