Facemorph.psychomorph.videomorph
Class VideoMorph

java.lang.Object
  extended by Facemorph.psychomorph.videomorph.VideoMorph

public class VideoMorph
extends java.lang.Object

Video morphing class, just morphs between two delineated videos doing time resampling


Constructor Summary
VideoMorph()
           
 
Method Summary
 java.awt.image.BufferedImage getFrame(int frame, float weight)
          Get an interpolated frame
 float[] getFrames(int outFrame, float weight)
          Gets the frame number to morph from the two sequences for output frame outFrame at morph weight
 java.awt.image.BufferedImage getImage1(int i)
          Get the ith image from set 1
 java.awt.image.BufferedImage getImage2(int i)
          Get the ith image from set 2
 float getLength(float weight)
          Gets the length of the interpolated sequence
 int getLengthData1()
          Get the length of image set 1
 int getLengthData2()
          Get the length of image set 2
 java.util.ArrayList<java.awt.image.BufferedImage> getMorph(float weight)
          Calculates and gets the morphed sequence
 java.util.ArrayList<Template> getMorphTemplates()
          Get the templates, should only be called after getMorph
 Template getTemplate1(int i)
          Get the ith template from set 1
 Template getTemplate2(int i)
          Get the ith template from set 2
static void main(java.lang.String[] args)
          Test method
 void readData1(java.lang.String list1)
          Read the first set of images (video data split into images)
 void readData2(java.lang.String list2)
          Read the second set of images (video data split into images)
static void readImagesAndTemplates(java.lang.String listFile, java.util.ArrayList<java.awt.image.BufferedImage> images, java.util.ArrayList<Template> templates)
          Read images and templates from a file
 void readTimePoints(java.lang.String timepoints)
          Read a file containing time points The time points should be arranged on two lines, one for each sequence the times should be integer frame numbers and should be in order probably best starting at 0 and ending at the length of the sequence
 void setProgressBar(javax.swing.JProgressBar pb)
          Set the progress bar that needs to be notified of progress updates
 void writeImages(java.util.ArrayList<java.awt.image.BufferedImage> images, java.lang.String outputRoot)
          Write the sequence to file
 void writeTemplates(java.util.ArrayList<Template> templates, java.lang.String outputRoot)
          Write the sequence templates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoMorph

public VideoMorph()
Method Detail

readImagesAndTemplates

public static void readImagesAndTemplates(java.lang.String listFile,
                                          java.util.ArrayList<java.awt.image.BufferedImage> images,
                                          java.util.ArrayList<Template> templates)
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Read images and templates from a file

Parameters:
listFile - the list of images and templates
images - the image array to put the images into
templates - the template array to put the templates into
Throws:
java.io.FileNotFoundException
java.io.IOException

setProgressBar

public void setProgressBar(javax.swing.JProgressBar pb)
Set the progress bar that needs to be notified of progress updates

Parameters:
pb - the progress bar to update

readData1

public void readData1(java.lang.String list1)
               throws java.io.FileNotFoundException,
                      java.io.IOException
Read the first set of images (video data split into images)

Parameters:
list1 - the list file for the video frames
Throws:
java.io.FileNotFoundException
java.io.IOException

readData2

public void readData2(java.lang.String list2)
               throws java.io.FileNotFoundException,
                      java.io.IOException
Read the second set of images (video data split into images)

Parameters:
list2 - the list file for the video frames
Throws:
java.io.FileNotFoundException
java.io.IOException

getImage1

public java.awt.image.BufferedImage getImage1(int i)
Get the ith image from set 1

Parameters:
i - the image index to retrieve
Returns:
return the image (if within range)

getImage2

public java.awt.image.BufferedImage getImage2(int i)
Get the ith image from set 2

Parameters:
i - the image index to retrieve
Returns:
return the image (if within range)

getTemplate1

public Template getTemplate1(int i)
Get the ith template from set 1

Parameters:
i - the template index to retrieve
Returns:
return the template (if within range)

getTemplate2

public Template getTemplate2(int i)
Get the ith template from set 2

Parameters:
i - the template index to retrieve
Returns:
return the template (if within range)

readTimePoints

public void readTimePoints(java.lang.String timepoints)
                    throws java.io.FileNotFoundException,
                           java.io.IOException
Read a file containing time points The time points should be arranged on two lines, one for each sequence the times should be integer frame numbers and should be in order probably best starting at 0 and ending at the length of the sequence

Parameters:
timepoints - the file containing the timepoints
Throws:
java.io.FileNotFoundException
java.io.IOException

getLength

public float getLength(float weight)
Gets the length of the interpolated sequence

Parameters:
weight - the fraction from sequence 1 to sequence 2
Returns:
return the length of the interpolated sequence

getFrames

public float[] getFrames(int outFrame,
                         float weight)
Gets the frame number to morph from the two sequences for output frame outFrame at morph weight

Parameters:
outFrame - the output frame number
weight - the fraction of sequence 2 to included in the blended video
Returns:
returns the positions in the two sequences as an array length 2

getFrame

public java.awt.image.BufferedImage getFrame(int frame,
                                             float weight)
Get an interpolated frame

Parameters:
frame - the output frame number
weight - the fraction of sequence 2 in th blended video
Returns:
returns the interpolated image

getMorphTemplates

public java.util.ArrayList<Template> getMorphTemplates()
Get the templates, should only be called after getMorph

Returns:
returns the morph templates

getMorph

public java.util.ArrayList<java.awt.image.BufferedImage> getMorph(float weight)
Calculates and gets the morphed sequence

Parameters:
weight - teh fraction from sequence 1 to sequence 2
Returns:
return the morphed sequence

writeImages

public void writeImages(java.util.ArrayList<java.awt.image.BufferedImage> images,
                        java.lang.String outputRoot)
                 throws java.io.IOException,
                        java.io.FileNotFoundException
Write the sequence to file

Parameters:
images - the images to write
outputRoot - the output name (frame number and .jpg are appended)
Throws:
java.io.IOException
java.io.FileNotFoundException

writeTemplates

public void writeTemplates(java.util.ArrayList<Template> templates,
                           java.lang.String outputRoot)
                    throws java.io.IOException,
                           java.io.FileNotFoundException
Write the sequence templates

Parameters:
templates - the templates to write
outputRoot - the output file name (frame number and .jpg are appended)
Throws:
java.io.IOException
java.io.FileNotFoundException

getLengthData1

public int getLengthData1()
Get the length of image set 1

Returns:
returns the number of frames in set 1

getLengthData2

public int getLengthData2()
Get the length of image set 2

Returns:
returns the number of frames in set 2

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.io.FileNotFoundException
Test method

Parameters:
args - the command line arguments
Throws:
java.io.IOException
java.io.FileNotFoundException