public class ObjectFacePittPattDescriptor extends ObjectByteVector implements ModifiableParametric
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
data
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Constructor and Description |
---|
ObjectFacePittPattDescriptor(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of ObjectFacePittPattDescriptor loaded from binary input.
|
ObjectFacePittPattDescriptor(java.io.BufferedReader stream)
Creates a new instance of ObjectFacePittPattDescriptor from stream.
|
ObjectFacePittPattDescriptor(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters)
Creates a new instance of ObjectFacePittPattDescriptor from stream.
|
ObjectFacePittPattDescriptor(byte[] data)
Creates a new instance of ObjectFacePittPattDescriptor from provided data.
|
ObjectFacePittPattDescriptor(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
byte[] data)
Creates a new instance of ObjectFacePittPattDescriptor from provided data.
|
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
boolean |
containsParameter(java.lang.String name)
Returns whether a parameter with the given
name exists in this parametric object. |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
protected float |
getDistanceImpl(LocalAbstractObject obj,
float distThreshold)
Distance function for PittPatt descriptors.
|
float |
getMaxDistance()
Returns a maximal possible distance for this class.
|
java.io.Serializable |
getParameter(java.lang.String name)
Returns an additional parameter with the given
name . |
<T> T |
getParameter(java.lang.String name,
java.lang.Class<? extends T> parameterClass)
Returns an additional parameter with the given
name . |
<T> T |
getParameter(java.lang.String name,
java.lang.Class<? extends T> parameterClass,
T defaultValue)
Returns an additional parameter with the given
name . |
int |
getParameterCount()
Returns the number of additional parameters.
|
java.util.Map<java.lang.String,? extends java.io.Serializable> |
getParameterMap()
Returns the map of all additional parameters.
|
java.util.Collection<java.lang.String> |
getParameterNames()
Returns a set of additional parameter names present in this object.
|
java.io.Serializable |
getRequiredParameter(java.lang.String name)
Returns an additional parameter with the given
name . |
<T> T |
getRequiredParameter(java.lang.String name,
java.lang.Class<? extends T> parameterClass)
Returns an additional parameter with the given
name . |
boolean |
hasFace()
Returns whether this object has a PittPatt face template for recognition.
|
static boolean |
isIsLibraryLoaded()
Returns true if the PittPatt library was successfully loaded.
|
java.io.Serializable |
removeParameter(java.lang.String name)
Removes an additional parameter with the given
name . |
java.io.Serializable |
setParameter(java.lang.String name,
java.lang.Object value)
Set an additional parameter with the given
name to the given value . |
protected void |
writeData(java.io.OutputStream stream)
Store this object's data to a text stream.
|
cloneRandomlyModify, dataEquals, dataHashCode, getDimensionality, getMinMaxForEveryCoord, getMinMaxOverCoords, getMinMaxOverCoords, getSize, getVectorData, getVectorDataDimension, getVectorDataItem, getVectorDataItemByte, parseByteHexString, parseByteVector, randomData, toString, writeByteHexString, writeByteVector
clearSurplusData, clone, clone, create, create, createMetaDistancesHolder, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceLowerBoundImpl, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getDistanceUpperBoundImpl, getFieldsForNames, getNormDistance, getPrecomputedDistance, getPrecomputedDistance, getRandomChar, getRandomNormal, chainDestroy, chainFilter, includeUsingPrecompDist, isDistanceCompatible, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
public ObjectFacePittPattDescriptor(byte[] data)
data
- the PittPatt data for recognitionpublic ObjectFacePittPattDescriptor(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, byte[] data)
additionalParameters
- additional parameters for this meta objectdata
- the PittPatt data for recognitionpublic ObjectFacePittPattDescriptor(java.io.BufferedReader stream) throws java.io.IOException, java.io.EOFException, java.lang.NumberFormatException, java.lang.IllegalArgumentException
stream
- the stream to read object's data fromjava.io.IOException
- if there was an error during reading from the given streamjava.io.EOFException
- when end-of-file of the given stream is reachedjava.lang.NumberFormatException
- when the line read from given stream does not consist of comma-separated or space-separated numbersjava.lang.IllegalArgumentException
- if the read data is not validpublic ObjectFacePittPattDescriptor(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters) throws java.io.IOException, java.io.EOFException, java.lang.NumberFormatException, java.lang.IllegalArgumentException
stream
- the stream to read object's data fromadditionalParameters
- additional parameters for this meta objectjava.io.IOException
- if there was an error during reading from the given streamjava.io.EOFException
- when end-of-file of the given stream is reachedjava.lang.NumberFormatException
- when the line read from given stream does not consist of comma-separated or space-separated numbersjava.lang.IllegalArgumentException
- if the read data is not validpublic ObjectFacePittPattDescriptor(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the ObjectFacePittPattDescriptor fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferpublic static boolean isIsLibraryLoaded()
distance
method will throw exception.public boolean hasFace()
public int getParameterCount()
Parametric
getParameterCount
in interface Parametric
public java.util.Collection<java.lang.String> getParameterNames()
Parametric
getParameterNames
in interface Parametric
public boolean containsParameter(java.lang.String name)
Parametric
name
exists in this parametric object.containsParameter
in interface Parametric
name
- the name of the additional parameter to getname
or false if it does notpublic java.io.Serializable getParameter(java.lang.String name)
Parametric
name
.getParameter
in interface Parametric
name
- the name of the additional parameter to getname
or null if it is not setpublic java.io.Serializable getRequiredParameter(java.lang.String name) throws java.lang.IllegalArgumentException
Parametric
name
.
If the parameter with the given name
is not set, an exception is thrown.getRequiredParameter
in interface Parametric
name
- the name of the additional parameter to getname
java.lang.IllegalArgumentException
- if the parameter with the given name
is not setpublic <T> T getRequiredParameter(java.lang.String name, java.lang.Class<? extends T> parameterClass) throws java.lang.IllegalArgumentException, java.lang.ClassCastException
Parametric
name
.
If the parameter with the given name
is not set or is not an
instance of parameterClass
, an exception is thrown.getRequiredParameter
in interface Parametric
T
- the class of the parametername
- the name of the additional parameter to getparameterClass
- the class of the parameter to getjava.lang.IllegalArgumentException
- if the parameter with the given name
is not setjava.lang.ClassCastException
- if the parameter with the given name
is not an instance of parameterClass
public <T> T getParameter(java.lang.String name, java.lang.Class<? extends T> parameterClass, T defaultValue)
Parametric
name
.
If the parameter is not set or is not an instance of parameterClass
,
the defaultValue
is returned instead.getParameter
in interface Parametric
T
- the class of the parametername
- the name of the additional parameter to getparameterClass
- the class of the parameter to getdefaultValue
- the default value to use if the parameter is nullpublic <T> T getParameter(java.lang.String name, java.lang.Class<? extends T> parameterClass)
Parametric
name
.
If the parameter name
exists but it is not an instance of
parameterClass
, null is returned.getParameter
in interface Parametric
T
- the class of the parametername
- the name of the additional parameter to getparameterClass
- the class of the parameter to getname
or null if it is not setpublic java.util.Map<java.lang.String,? extends java.io.Serializable> getParameterMap()
Parametric
getParameterMap
in interface Parametric
public java.io.Serializable removeParameter(java.lang.String name)
ModifiableParametric
name
.removeParameter
in interface ModifiableParametric
name
- the name of the additional parameter to removename
that was removed or null if it was not setpublic java.io.Serializable setParameter(java.lang.String name, java.lang.Object value) throws java.lang.ClassCastException
ModifiableParametric
name
to the given value
.
Note that the previous value is replaced with the new one.setParameter
in interface ModifiableParametric
name
- the name of the additional parameter to setvalue
- the new value for the parametername
or null if it was not setjava.lang.ClassCastException
protected void writeData(java.io.OutputStream stream) throws java.io.IOException
LocalAbstractObject
writeData
in class ObjectByteVector
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streamprotected float getDistanceImpl(LocalAbstractObject obj, float distThreshold) throws java.lang.IllegalStateException
getDistanceImpl
in class LocalAbstractObject
obj
- the object to compute distance todistThreshold
- the threshold value on the distancejava.lang.IllegalStateException
- if the PittPatt library was not loadedpublic float getMaxDistance()
LocalAbstractObject
LocalAbstractObject.MAX_DISTANCE
.getMaxDistance
in class LocalAbstractObject
public int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
LocalAbstractObject
output
.binarySerialize
in interface BinarySerializable
binarySerialize
in class ObjectByteVector
output
- the output that this object is binary-serialized intoserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error during serializationpublic int getBinarySize(BinarySerializator serializator)
LocalAbstractObject
getBinarySize
in interface BinarySerializable
getBinarySize
in class ObjectByteVector
serializator
- the serializator used to write objects