Class HumanFaceImpl
java.lang.Object
cz.fidentis.analyst.data.face.impl.HumanFaceImpl
- All Implemented Interfaces:
HumanFace
,HumanFaceEventBus
,Serializable
A human face implementation.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHumanFaceImpl
(MeshModel model, String id) Creates a human face from existing mesh model.HumanFaceImpl
(File file) Reads a 3D human face from the given OBJ file.HumanFaceImpl
(File file, boolean loadLandmarks) Reads a 3D human face from the given OBJ file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomLandmark
(Landmark landmark) Adds custom landmark to facevoid
Broadcast event to registered listeners.boolean
protected File
Tries to find a file with landmarks definition based on the name of the face's OBJ file.Returns all feature points or empty list.Returns bounding box ornull
Returns canonical path to the folder in which the face file is located, i.e.,HumanFace.getPath()
withHumanFace.getShortName()
suffix removed.Gets the glyphs of the face or empty listgetId()
Returns unique ID of the face.Returns already computed k-d tree of the triangular mesh ornull
.Returns the triangular mesh model of the human face.Returns already computed octree of the triangular mesh ornull
.getPath()
Returns canonical path to the face fileReturns short name of the face without its path in the name.getState()
Returns a deep copy of current state.Returns Interactive mask.boolean
Checks if the human face has assigned a bounding boxboolean
Checks if the human face has assigned glyphsint
hashCode()
boolean
Checks if HumanFace has KdTree calculatedboolean
Checks if HumanFace has feature pointsboolean
Checks if HumanFace has octree calculatedboolean
Returnstrue
if the face has the symmetry plane computed.void
loadFeaturePoints
(String path, String fileName) Reads feature points from a file on the given path.void
registerListener
(HumanFaceListener listener) Registers listeners (objects concerned in the human face changes) to receive events.boolean
removeCustomLandmark
(Landmark landmark) Removes custom landmark from facevoid
setBoundingBox
(Box boundingBox) Set a bounding box.void
Sets the glyphs.void
Sets teh octreefinal void
setMeshModel
(MeshModel meshModel) Sets the mesh model.void
Sets teh octreevoid
setState
(HumanFaceState state) Falls back to given state.void
setSurfaceMask
(SurfaceMask surfaceMask) Set a surface mask.void
setSymmetryPlane
(Plane plane) Sets the symmetry plane.void
unregisterListener
(HumanFaceListener listener) Unregisters listeners from receiving events.
-
Field Details
-
Constructor Details
-
HumanFaceImpl
Reads a 3D human face from the given OBJ file.- Parameters:
file
- OBJ fileloadLandmarks
- Iftrue
, then the constructor aims to load landmarks along with the mesh. UsegetAllLandmarks()
to check whether the landmarks (feature points) has been loaded.- Throws:
IOException
- on I/O failure
-
HumanFaceImpl
Reads a 3D human face from the given OBJ file. Also loads landmarks (feature points) if appropriate file is found.- Parameters:
file
- OBJ file- Throws:
IOException
- on I/O failure
-
HumanFaceImpl
Creates a human face from existing mesh model. The mesh model is stored directly (not copied).- Parameters:
model
- Mesh modelid
- Canonical path to the OBJ file- Throws:
IllegalArgumentException
- if themodel
isnull
-
-
Method Details
-
getMeshModel
Returns the triangular mesh model of the human face.- Specified by:
getMeshModel
in interfaceHumanFace
- Returns:
- the triangular mesh model of the human face
-
setMeshModel
Description copied from interface:HumanFace
Sets the mesh model.- Specified by:
setMeshModel
in interfaceHumanFace
- Parameters:
meshModel
- new mesh model, must not benull
-
setSymmetryPlane
Description copied from interface:HumanFace
Sets the symmetry plane. If the input argument isnull
, then removes the plane.- Specified by:
setSymmetryPlane
in interfaceHumanFace
- Parameters:
plane
- The new symmetry plane
-
getSymmetryPlane
- Specified by:
getSymmetryPlane
in interfaceHumanFace
- Returns:
- The face's symmetry plane
-
hasSymmetryPlane
public boolean hasSymmetryPlane()Description copied from interface:HumanFace
Returnstrue
if the face has the symmetry plane computed.- Specified by:
hasSymmetryPlane
in interfaceHumanFace
- Returns:
true
if the face has the symmetry plane computed.
-
loadFeaturePoints
Description copied from interface:HumanFace
Reads feature points from a file on the given path.- Specified by:
loadFeaturePoints
in interfaceHumanFace
- Parameters:
path
- Directory where the file is locatedfileName
- Name of the file- Throws:
IOException
- on I/O failure
-
getAllLandmarks
Description copied from interface:HumanFace
Returns all feature points or empty list.- Specified by:
getAllLandmarks
in interfaceHumanFace
- Returns:
- The face's feature points.
-
getStandardFeaturePoints
- Specified by:
getStandardFeaturePoints
in interfaceHumanFace
- Returns:
- list of standard feature points
-
getCustomLandmarks
- Specified by:
getCustomLandmarks
in interfaceHumanFace
- Returns:
- list of custom feature points
-
addCustomLandmark
Description copied from interface:HumanFace
Adds custom landmark to face- Specified by:
addCustomLandmark
in interfaceHumanFace
-
removeCustomLandmark
Description copied from interface:HumanFace
Removes custom landmark from face- Specified by:
removeCustomLandmark
in interfaceHumanFace
- Parameters:
landmark
- Landmark to remove- Returns:
- true if the landmark was removed, false otherwise
-
hasLandmarks
public boolean hasLandmarks()Description copied from interface:HumanFace
Checks if HumanFace has feature points- Specified by:
hasLandmarks
in interfaceHumanFace
- Returns:
- true if yes and false if not
-
getId
Description copied from interface:HumanFace
Returns unique ID of the face. -
getPath
Description copied from interface:HumanFace
Returns canonical path to the face file -
getShortName
Description copied from interface:HumanFace
Returns short name of the face without its path in the name. May not be unique.- Specified by:
getShortName
in interfaceHumanFace
- Returns:
- short name of the face without its path in the name
-
getDirectory
Description copied from interface:HumanFace
Returns canonical path to the folder in which the face file is located, i.e.,HumanFace.getPath()
withHumanFace.getShortName()
suffix removed.- Specified by:
getDirectory
in interfaceHumanFace
- Returns:
- Returns canonical path to the folder in which the face file is located
-
getOctree
Description copied from interface:HumanFace
Returns already computed octree of the triangular mesh ornull
. -
hasOctree
public boolean hasOctree()Description copied from interface:HumanFace
Checks if HumanFace has octree calculated -
setOctree
Description copied from interface:HumanFace
Sets teh octree -
getKdTree
Description copied from interface:HumanFace
Returns already computed k-d tree of the triangular mesh ornull
. -
setKdTree
Description copied from interface:HumanFace
Sets teh octree -
hasKdTree
public boolean hasKdTree()Description copied from interface:HumanFace
Checks if HumanFace has KdTree calculated -
getSurfaceMask
Description copied from interface:HumanFace
Returns Interactive mask. The mask can be empty;- Specified by:
getSurfaceMask
in interfaceHumanFace
- Returns:
- the interactive mask
-
registerListener
Description copied from interface:HumanFaceEventBus
Registers listeners (objects concerned in the human face changes) to receive events. If listener isnull
, no exception is thrown and no action is taken.- Specified by:
registerListener
in interfaceHumanFaceEventBus
- Parameters:
listener
- Listener concerned in the human face changes.
-
unregisterListener
Description copied from interface:HumanFaceEventBus
Unregisters listeners from receiving events.- Specified by:
unregisterListener
in interfaceHumanFaceEventBus
- Parameters:
listener
- Registered listener
-
announceEvent
Description copied from interface:HumanFaceEventBus
Broadcast event to registered listeners.- Specified by:
announceEvent
in interfaceHumanFaceEventBus
- Parameters:
evt
- Event to be triggered.
-
getState
Description copied from interface:HumanFace
Returns a deep copy of current state. -
setState
Description copied from interface:HumanFace
Falls back to given state. No event is triggered - it up to the caller. -
getGlyphs
Description copied from interface:HumanFace
Gets the glyphs of the face or empty list -
setGlyphs
Description copied from interface:HumanFace
Sets the glyphs. -
hasGlyphs
public boolean hasGlyphs()Description copied from interface:HumanFace
Checks if the human face has assigned glyphs -
getBoundingBox
Description copied from interface:HumanFace
Returns bounding box ornull
- Specified by:
getBoundingBox
in interfaceHumanFace
- Returns:
- bounding box or
null
-
setBoundingBox
Description copied from interface:HumanFace
Set a bounding box.- Specified by:
setBoundingBox
in interfaceHumanFace
- Parameters:
boundingBox
- Bounding box ornull
-
hasBoundingBox
public boolean hasBoundingBox()Description copied from interface:HumanFace
Checks if the human face has assigned a bounding box- Specified by:
hasBoundingBox
in interfaceHumanFace
- Returns:
true
, if the bounding box exists
-
setSurfaceMask
Description copied from interface:HumanFace
Set a surface mask.- Specified by:
setSurfaceMask
in interfaceHumanFace
- Parameters:
surfaceMask
- surfaceMask ornull
-
hashCode
public int hashCode() -
equals
-
findLandmarks
Tries to find a file with landmarks definition based on the name of the face's OBJ file.- Returns:
- The file with landmarks or
null
-