Class FacesProxy

java.lang.Object
cz.fidentis.analyst.project.FacesProxy
Direct Known Subclasses:
FacesProxyDecorator

public class FacesProxy extends Object
A proxy over the HumanFaceFactory. It handles faces processed by a single analytical task or project. This class introduces lazy allocation of human faces in addition to automatic memory management provided by the HumanFaceFactory.
  • Constructor Details

    • FacesProxy

      public FacesProxy(List<File> faceFiles)
      Constructor for multiple faces, e.g., 1:N or N:N batch processing
      Parameters:
      faceFiles - faces of the task
    • FacesProxy

      public FacesProxy(File faceFile)
      Constructor for a single face analysis
      Parameters:
      faceFile - face of the task
    • FacesProxy

      public FacesProxy(File priFaceFile, File secFaceFile)
      Constructor for the analysis of two faces
      Parameters:
      priFaceFile - primary face
      secFaceFile - secondary face
    • FacesProxy

      public FacesProxy(File... faceFiles)
      Constructor for multiple faces, e.g., 1:N or N:N batch processing
      Parameters:
      faceFiles - faces of the task
    • FacesProxy

      public FacesProxy(ObjectInputStream in) throws IOException, ClassNotFoundException
      Deserialization constructor. It recovers faces from dump files
      Parameters:
      in - Input stream
      Throws:
      IOException - on IO error
      ClassNotFoundException - of format error
  • Method Details

    • serialize

      public void serialize(ObjectOutputStream out) throws IOException
      Serializes current state.
      Parameters:
      out - Output stream
      Throws:
      IOException - on IO error
    • getFaceFiles

      public List<File> getFaceFiles()
      Returns the list of paths to faces.
      Returns:
      the list of paths to faces.
    • getFaceFile

      public File getFaceFile(int index)
      Returns the file of a given face.
      Parameters:
      index - index of the face
      Returns:
      the file of a given face or null
    • getFaceFile

      public File getFaceFile(String faceName)
      Returns the file of a given face.
      Parameters:
      faceName - name of the face
      Returns:
      the file of a given face or null
    • getFace

      public HumanFace getFace(int index)
      Instantiates (if not yet instantiated) and returns a human face.
      Parameters:
      index - index of the face
      Returns:
      human face or null
    • getFaceIndex

      public int getFaceIndex(String faceName)
      Returns index of the face described by its canonical name,
      Parameters:
      faceName - Canonical name of the face
      Returns:
      index or -1
    • addFace

      public int addFace(File file, boolean unique)
      Adds a face to the set.
      Parameters:
      file - path to the face OBJ file
      unique - If true, then avoid adding a single face twice
      Returns:
      index of the added face, -1 the file is null, -2 if unique is true and the face is already in the set.
    • removeFace

      public boolean removeFace(String faceName)
      Removes face from the proxy.
      Parameters:
      faceName - Canonical name of the face
      Returns:
      false of the face does not exist or was not loaded
    • isInMemory

      public boolean isInMemory(int index)
      Checks whether the face is already loaded in the memory.
      Parameters:
      index - index of the face
      Returns:
      true is the face is loaded.
    • getFaceName

      public String getFaceName(int index)
      Returns short (canonical) name of the face. In contrast to the getFace(x).getShortName(), this method does not need face instance allocated in the memory.
      Parameters:
      index - index of the face
      Returns:
      short name of the face
    • getFacePath

      public String getFacePath(int index, FacesProxy.FaceFileType type)
      Returns path to the given face file or null.
      Parameters:
      index - index of the face
      type - face file type
      Returns:
      path or null
    • getFaceDir

      public String getFaceDir(int index)
      Returns path to the face directory or null.
      Parameters:
      index - index of the face
      Returns:
      path to face folder or null
    • getPrimaryFace

      public HumanFace getPrimaryFace()
      Instantiates (if not yet instantiated) and returns the first face from the list of faces. The first face is called primary.
      Returns:
      the first (primary) face from the list of faces
    • getSecondaryFace

      public HumanFace getSecondaryFace()
      Instantiates (if not yet instantiated) and returns the second face from the list of faces. The second face is called secondary.
      Returns:
      the second (secondary) face from the list of faces
    • getNumFaces

      public int getNumFaces()
      Returns the number of faces
      Returns:
      the number of faces
    • getTaskName

      public String getTaskName()
      Returns the task name that encodes names of faces.
      Returns:
      a text that encodes names of faces.
    • getCanonicalName

      public static String getCanonicalName(File file)
      Returns name of the file without appendix and path
      Parameters:
      file - path to the file
      Returns:
      canonical name
    • equals

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

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

      public HumanFaceMemoryManager getFactory()