viper.descriptors
Class Converter

java.lang.Object
  extended byviper.descriptors.Converter

public class Converter
extends java.lang.Object

Class for converting from old .gtf format to new XML format.


Field Summary
static double DROP_DESCRIPTOR
          Used with the deform option, this is the probability of dropping a descriptor.
static double GROW_SHAPE
          Used with the deform option, this is the probability of increasing the size of a shape attribute.
static double SHRINK_SHAPE
          Used with the deform option, this is the probability of shrinking a shape attribute.
static double SPLIT_BBOX
          Used with the deform option, this is the probability of splitting any bounding box.
static double SPLIT_DESCRIPTOR
          Used with the deform option, this is the probability of splitting a descriptor over time.
 
Constructor Summary
Converter(DescriptorData descriptors, java.util.Properties props)
          Create a new converter object for the given set of descriptor lists.
 
Method Summary
 void clip()
          Sets each descriptor to its first frame.
 void cropFrames(int n)
          Crops all frames >= n
 void deform()
          Deforms the data.
protected  void deformList(DescriptorList data)
          Deformer works by applying list-level, descriptor-level, and attribute-level deformations: the list level ones basically consist of dropping random descriptors.
static DescriptorConfigs getConfigs(org.w3c.dom.Document root)
          Gets the descriptor schema described in the give viper xml file.
static RuleHolder getRuleHolder(DescriptorConfigs gtCfgs, java.lang.String filterName)
          Parses in the given rules file.
static void main(java.lang.String[] args)
          Converts some gtf files into another format.
static void printUsage(java.io.PrintWriter output)
          Prints the usage statement for the gtf file conversion application.
static void saveAsXml(java.lang.String gtfName, java.io.PrintWriter out)
          Converts a GTF to an XML file.
 void setDimensions(int[] dims)
          Modifies the dimension of all the input canonical file descriptors.
 void shift(int n)
          Shifts each framespan by n.
 void split()
          Splits descriptors into contiguous objects.
 void writeGtf(java.io.PrintWriter out)
          Writes the current data in the ViPER GTF format
 void writeXml(java.io.PrintWriter out, boolean header)
          Writes the current data in the ViPER XML format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DROP_DESCRIPTOR

public static final double DROP_DESCRIPTOR
Used with the deform option, this is the probability of dropping a descriptor.

See Also:
Constant Field Values

SPLIT_DESCRIPTOR

public static final double SPLIT_DESCRIPTOR
Used with the deform option, this is the probability of splitting a descriptor over time.

See Also:
Constant Field Values

SPLIT_BBOX

public static final double SPLIT_BBOX
Used with the deform option, this is the probability of splitting any bounding box.

See Also:
Constant Field Values

GROW_SHAPE

public static final double GROW_SHAPE
Used with the deform option, this is the probability of increasing the size of a shape attribute.

See Also:
Constant Field Values

SHRINK_SHAPE

public static final double SHRINK_SHAPE
Used with the deform option, this is the probability of shrinking a shape attribute.

See Also:
Constant Field Values
Constructor Detail

Converter

public Converter(DescriptorData descriptors,
                 java.util.Properties props)
Create a new converter object for the given set of descriptor lists.

Parameters:
descriptors - The data to manipulate and write out.
props - the java properties to use while construction the converter
Method Detail

printUsage

public static void printUsage(java.io.PrintWriter output)
Prints the usage statement for the gtf file conversion application.

Parameters:
output - the stream to receive the usage statement.

saveAsXml

public static void saveAsXml(java.lang.String gtfName,
                             java.io.PrintWriter out)
                      throws java.io.IOException
Converts a GTF to an XML file. This method is called from Viper GT's ViperFrame class when "Save as XML" menu item is chosen in Viper's GUI.

Parameters:
gtfName - the name of the file to be saved as XML
out - the stream to which the method will write the XML output.
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Converts some gtf files into another format.

Parameters:
args - see the usage statement
Throws:
java.io.IOException - if there is an error while reading from or writing to the input or output files

writeXml

public void writeXml(java.io.PrintWriter out,
                     boolean header)
              throws java.io.IOException
Writes the current data in the ViPER XML format.

Parameters:
out - The output stream.
header - true will include the xml header string.
Throws:
java.io.IOException

writeGtf

public void writeGtf(java.io.PrintWriter out)
Writes the current data in the ViPER GTF format

Parameters:
out - The output stream.

setDimensions

public void setDimensions(int[] dims)
Modifies the dimension of all the input canonical file descriptors.

Parameters:
dims - the new width and height (in that order)

split

public void split()
Splits descriptors into contiguous objects.
N.B. This will reset the ids of the objects.


clip

public void clip()
Sets each descriptor to its first frame. Useful for distributing first frame ground truth data.


shift

public void shift(int n)
Shifts each framespan by n.

Parameters:
n - the number of frames to shift by

cropFrames

public void cropFrames(int n)
Crops all frames >= n

Parameters:
n - one after the last frame in the output

getConfigs

public static DescriptorConfigs getConfigs(org.w3c.dom.Document root)
                                    throws BadDataException
Gets the descriptor schema described in the give viper xml file.

Parameters:
root - the viper xml data
Returns:
the configs, if any, found within
Throws:
BadDataException - if there is an error in the configs, or no configs node.

getRuleHolder

public static RuleHolder getRuleHolder(DescriptorConfigs gtCfgs,
                                       java.lang.String filterName)
                                throws java.io.IOException
Parses in the given rules file.

Parameters:
gtCfgs - the associated descriptor schema
filterName - the name of the filter file
Returns:
the filter described in the file
Throws:
java.io.IOException - if there is an error while reading from the given file, or if the file does not exist

deform

public void deform()
Deforms the data.


deformList

protected void deformList(DescriptorList data)
Deformer works by applying list-level, descriptor-level, and attribute-level deformations: the list level ones basically consist of dropping random descriptors. I suppose one day I could figure out how to make up new ones at random...

Parameters:
data - the data to deform