Class HumanFaceImpl

java.lang.Object
cz.fidentis.analyst.data.face.impl.HumanFaceImpl
All Implemented Interfaces:
HumanFace, Serializable

public class HumanFaceImpl extends Object implements HumanFace
A human face implementation.
See Also:
  • Constructor Details

    • HumanFaceImpl

      public HumanFaceImpl(File file, boolean loadLandmarks) throws IOException
      Reads a 3D human face from the given OBJ file.
      Parameters:
      file - OBJ file
      loadLandmarks - If true, then the constructor aims to load landmarks along with the mesh. Use
      invalid @link
      {@link #getLandmarks().hasLandmarks()
      } to check whether the landmarks (feature points) has been loaded.
      Throws:
      IOException - on I/O failure
    • HumanFaceImpl

      public HumanFaceImpl(File file) throws IOException
      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

      public HumanFaceImpl(String name, MeshModel model, boolean isAverageFace)
      Creates a human face from existing mesh model. The mesh model is stored directly (not copied).
      Parameters:
      model - Mesh model
      Throws:
      IllegalArgumentException - if the model is null
  • Method Details

    • getMeshModel

      public MeshModel getMeshModel()
      Returns the triangular mesh model of the human face.
      Specified by:
      getMeshModel in interface HumanFace
      Returns:
      the triangular mesh model of the human face
    • setSymmetryPlane

      public void setSymmetryPlane(Plane plane)
      Description copied from interface: HumanFace
      Sets the symmetry plane. If the input argument is null, then removes the plane.
      Specified by:
      setSymmetryPlane in interface HumanFace
      Parameters:
      plane - The new symmetry plane
    • getSymmetryPlane

      public Plane getSymmetryPlane()
      Specified by:
      getSymmetryPlane in interface HumanFace
      Returns:
      The face's symmetry plane
    • hasSymmetryPlane

      public boolean hasSymmetryPlane()
      Description copied from interface: HumanFace
      Returns true if the face has the symmetry plane computed.
      Specified by:
      hasSymmetryPlane in interface HumanFace
      Returns:
      true if the face has the symmetry plane computed.
    • getLandmarks

      public Landmarks getLandmarks()
      Description copied from interface: HumanFace
      Returns landmarks of the face.
      Specified by:
      getLandmarks in interface HumanFace
      Returns:
      Landmarks of the face
    • getShortName

      public String 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 interface HumanFace
      Returns:
      short name of the face without its path in the name
    • getOctree

      public Octree getOctree()
      Description copied from interface: HumanFace
      Returns already computed octree of the triangular mesh or null.
      Specified by:
      getOctree in interface HumanFace
      Returns:
      Already computed octree of the triangular mesh or null
    • hasOctree

      public boolean hasOctree()
      Description copied from interface: HumanFace
      Checks if HumanFace has octree calculated
      Specified by:
      hasOctree in interface HumanFace
      Returns:
      true if yes and false if not
    • setOctree

      public void setOctree(Octree octree)
      Description copied from interface: HumanFace
      Sets the octree
      Specified by:
      setOctree in interface HumanFace
      Parameters:
      octree - New octree. Can be null
    • getKdTree

      public KdTree getKdTree()
      Description copied from interface: HumanFace
      Returns already computed k-d tree of the triangular mesh or null.
      Specified by:
      getKdTree in interface HumanFace
      Returns:
      Already computed k-d tree of the triangular mesh or null
    • setKdTree

      public void setKdTree(KdTree kdTree)
      Description copied from interface: HumanFace
      Sets the k-d tree
      Specified by:
      setKdTree in interface HumanFace
      Parameters:
      kdTree - New k-d tree. Can be null
    • hasKdTree

      public boolean hasKdTree()
      Description copied from interface: HumanFace
      Checks if HumanFace has KdTree calculated
      Specified by:
      hasKdTree in interface HumanFace
      Returns:
      true if yes and false if not
    • getLeftBalancedKdTree

      public LeftBalancedKdTree getLeftBalancedKdTree()
      Description copied from interface: HumanFace
      Returns already computed left-balanced k-d tree of the triangular mesh or null.
      Specified by:
      getLeftBalancedKdTree in interface HumanFace
      Returns:
      Already computed left-balanced k-d tree of the triangular mesh or null
    • setLeftBalancedKdTree

      public void setLeftBalancedKdTree(LeftBalancedKdTree kdTree)
      Description copied from interface: HumanFace
      Sets the k-d tree left-balanced k-d tree.
      Specified by:
      setLeftBalancedKdTree in interface HumanFace
      Parameters:
      kdTree - New left-balanced k-d tree. Can be null.
    • hasLeftBalancedKdTree

      public boolean hasLeftBalancedKdTree()
      Description copied from interface: HumanFace
      Checks if HumanFace has LeftBalancedKdTree calculated
      Specified by:
      hasLeftBalancedKdTree in interface HumanFace
      Returns:
      true if yes and false if not
    • getSurfaceMask

      public SurfaceMask getSurfaceMask()
      Description copied from interface: HumanFace
      Returns Interactive mask. The mask can be empty;
      Specified by:
      getSurfaceMask in interface HumanFace
      Returns:
      the interactive mask
    • getState

      public HumanFaceState getState()
      Description copied from interface: HumanFace
      Returns a deep copy of current state.
      Specified by:
      getState in interface HumanFace
      Returns:
      a deep copy of current state.
    • setState

      public void setState(HumanFaceState state)
      Description copied from interface: HumanFace
      Falls back to given state. No event is triggered - it up to the caller.
      Specified by:
      setState in interface HumanFace
      Parameters:
      state - Old state. Must not be null
    • getGlyphs

      public List<Glyph> getGlyphs()
      Description copied from interface: HumanFace
      Gets the glyphs of the face or empty list
      Specified by:
      getGlyphs in interface HumanFace
      Returns:
      list of glyphs or empty list
    • setGlyphs

      public void setGlyphs(List<Glyph> glyphs)
      Description copied from interface: HumanFace
      Sets the glyphs.
      Specified by:
      setGlyphs in interface HumanFace
      Parameters:
      glyphs - Glyphs. Can be null
    • hasGlyphs

      public boolean hasGlyphs()
      Description copied from interface: HumanFace
      Checks if the human face has assigned glyphs
      Specified by:
      hasGlyphs in interface HumanFace
      Returns:
      true, if the glyphs exist
    • getBoundingBox

      public Box getBoundingBox()
      Description copied from interface: HumanFace
      Returns bounding box or null
      Specified by:
      getBoundingBox in interface HumanFace
      Returns:
      bounding box or null
    • setBoundingBox

      public void setBoundingBox(Box boundingBox)
      Description copied from interface: HumanFace
      Set a bounding box.
      Specified by:
      setBoundingBox in interface HumanFace
      Parameters:
      boundingBox - Bounding box or null
    • hasBoundingBox

      public boolean hasBoundingBox()
      Description copied from interface: HumanFace
      Checks if the human face has assigned a bounding box
      Specified by:
      hasBoundingBox in interface HumanFace
      Returns:
      true, if the bounding box exists
    • setSurfaceMask

      public void setSurfaceMask(SurfaceMask surfaceMask)
      Description copied from interface: HumanFace
      Set a surface mask.
      Specified by:
      setSurfaceMask in interface HumanFace
      Parameters:
      surfaceMask - surfaceMask or null
    • getFaceFrontalDirection

      public Ray getFaceFrontalDirection()
      Description copied from interface: HumanFace
      Gets face frontal direction.
      Specified by:
      getFaceFrontalDirection in interface HumanFace
      Returns:
      face frontal direction
    • setFaceFrontalDirection

      public void setFaceFrontalDirection(Ray faceFrontalDirection)
      Description copied from interface: HumanFace
      Set face frontal direction.
      Specified by:
      setFaceFrontalDirection in interface HumanFace
      Parameters:
      faceFrontalDirection - new face frontal direction
    • hasFaceFrontalDirection

      public boolean hasFaceFrontalDirection()
      Description copied from interface: HumanFace
      Checks face frontal direction is computed.
      Specified by:
      hasFaceFrontalDirection in interface HumanFace
      Returns:
      true if face frontal direction exists
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isAverageFace

      public boolean isAverageFace()
      Specified by:
      isAverageFace in interface HumanFace
      Returns:
      is average face
    • findLandmarks

      protected File findLandmarks(String fileId)
      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