Facemorph.haar
Class HaarReader

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<HaarStage>
              extended by Facemorph.haar.HaarReader
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<HaarStage>, java.util.Collection<HaarStage>, java.util.List<HaarStage>, java.util.RandomAccess

public class HaarReader
extends java.util.ArrayList<HaarStage>

Reads a Haar Cascade xml file into a list of HaarStages

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          ID for serialisation
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
HaarReader(java.lang.String file, boolean url)
          Constructor for a HaarReader object
 
Method Summary
 void calcHidRects(double scale)
          Calculate the hidden rectangles
 void flipHorizontal()
          Flip the object detector horizontally
 int getHeight()
          return the height
 int getHidHeight()
          return the hidden height
 int getHidWidth()
          return the hidden width
 int getWidth()
          return the width
static void main(java.lang.String[] args)
          Main method for testing
 java.lang.String stripComments(java.lang.String fileName)
          Strip comments from OpenCV haar files, this is because many of the files contain illegal comments (containing the -- string) which the java XML parser complains about
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

serialVersionUID

public static final long serialVersionUID
ID for serialisation

See Also:
Constant Field Values
Constructor Detail

HaarReader

public HaarReader(java.lang.String file,
                  boolean url)
Constructor for a HaarReader object

Parameters:
file - the file to read from
url - true if the file string represents a URL, a local file is assumed otherwise
Method Detail

stripComments

public java.lang.String stripComments(java.lang.String fileName)
                               throws java.io.FileNotFoundException
Strip comments from OpenCV haar files, this is because many of the files contain illegal comments (containing the -- string) which the java XML parser complains about

Parameters:
fileName - the name of the file to read into the string
Returns:
returns the file in a string with no comments
Throws:
java.io.FileNotFoundException

getWidth

public int getWidth()
return the width

Returns:
returns the width

getHeight

public int getHeight()
return the height

Returns:
returns the height

getHidWidth

public int getHidWidth()
return the hidden width

Returns:
returns the hidden width

getHidHeight

public int getHidHeight()
return the hidden height

Returns:
returns the hidden height

calcHidRects

public void calcHidRects(double scale)
Calculate the hidden rectangles

Parameters:
scale - the current search scale

flipHorizontal

public void flipHorizontal()
Flip the object detector horizontally


main

public static void main(java.lang.String[] args)
Main method for testing

Parameters:
args - the program args