Class HumanFaceImpl

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

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

  • Constructor Details Link icon

    • HumanFaceImpl Link icon

      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 getAllLandmarks() to check whether the landmarks (feature points) has been loaded.
      Throws:
      IOException - on I/O failure
    • HumanFaceImpl Link icon

      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 Link icon

      public HumanFaceImpl(MeshModel model, String id)
      Creates a human face from existing mesh model. The mesh model is stored directly (not copied).
      Parameters:
      model - Mesh model
      id - Canonical path to the OBJ file
      Throws:
      IllegalArgumentException - if the model is null
  • Method Details Link icon

    • getMeshModel Link icon

      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
    • setMeshModel Link icon

      public final void setMeshModel(MeshModel meshModel)
      Description copied from interface: HumanFace
      Sets the mesh model.
      Specified by:
      setMeshModel in interface HumanFace
      Parameters:
      meshModel - new mesh model, must not be null
    • setSymmetryPlane Link icon

      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 Link icon

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

      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.
    • loadFeaturePoints Link icon

      public void loadFeaturePoints(String path, String fileName) throws IOException
      Description copied from interface: HumanFace
      Reads feature points from a file on the given path.
      Specified by:
      loadFeaturePoints in interface HumanFace
      Parameters:
      path - Directory where the file is located
      fileName - Name of the file
      Throws:
      IOException - on I/O failure
    • getAllLandmarks Link icon

      public List<Landmark> getAllLandmarks()
      Description copied from interface: HumanFace
      Returns all feature points or empty list.
      Specified by:
      getAllLandmarks in interface HumanFace
      Returns:
      The face's feature points.
    • getStandardFeaturePoints Link icon

      public List<Landmark> getStandardFeaturePoints()
      Specified by:
      getStandardFeaturePoints in interface HumanFace
      Returns:
      list of standard feature points
    • getCustomLandmarks Link icon

      public List<Landmark> getCustomLandmarks()
      Specified by:
      getCustomLandmarks in interface HumanFace
      Returns:
      list of custom feature points
    • addCustomLandmark Link icon

      public void addCustomLandmark(Landmark landmark)
      Description copied from interface: HumanFace
      Adds custom landmark to face
      Specified by:
      addCustomLandmark in interface HumanFace
    • removeCustomLandmark Link icon

      public boolean removeCustomLandmark(Landmark landmark)
      Description copied from interface: HumanFace
      Removes custom landmark from face
      Specified by:
      removeCustomLandmark in interface HumanFace
      Parameters:
      landmark - Landmark to remove
      Returns:
      true if the landmark was removed, false otherwise
    • hasLandmarks Link icon

      public boolean hasLandmarks()
      Description copied from interface: HumanFace
      Checks if HumanFace has feature points
      Specified by:
      hasLandmarks in interface HumanFace
      Returns:
      true if yes and false if not
    • getId Link icon

      public String getId()
      Description copied from interface: HumanFace
      Returns unique ID of the face.
      Specified by:
      getId in interface HumanFace
      Returns:
      unique ID of the face.
    • getPath Link icon

      public String getPath()
      Description copied from interface: HumanFace
      Returns canonical path to the face file
      Specified by:
      getPath in interface HumanFace
      Returns:
      canonical path to the face file
    • getShortName Link icon

      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
    • getDirectory Link icon

      public String getDirectory()
      Description copied from interface: HumanFace
      Returns canonical path to the folder in which the face file is located, i.e., HumanFace.getPath() with HumanFace.getShortName() suffix removed.
      Specified by:
      getDirectory in interface HumanFace
      Returns:
      Returns canonical path to the folder in which the face file is located
    • getOctree Link icon

      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 Link icon

      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 Link icon

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

      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 Link icon

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

      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
    • getSurfaceMask Link icon

      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
    • registerListener Link icon

      public void registerListener(HumanFaceListener listener)
      Description copied from interface: HumanFaceEventBus
      Registers listeners (objects concerned in the human face changes) to receive events. If listener is null, no exception is thrown and no action is taken.
      Specified by:
      registerListener in interface HumanFaceEventBus
      Parameters:
      listener - Listener concerned in the human face changes.
    • unregisterListener Link icon

      public void unregisterListener(HumanFaceListener listener)
      Description copied from interface: HumanFaceEventBus
      Unregisters listeners from receiving events.
      Specified by:
      unregisterListener in interface HumanFaceEventBus
      Parameters:
      listener - Registered listener
    • announceEvent Link icon

      public void announceEvent(HumanFaceEvent evt)
      Description copied from interface: HumanFaceEventBus
      Broadcast event to registered listeners.
      Specified by:
      announceEvent in interface HumanFaceEventBus
      Parameters:
      evt - Event to be triggered.
    • getState Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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
    • hashCode Link icon

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • findLandmarks Link icon

      protected File 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