Class FaceStorageBackend

    • Constructor Detail

      • FaceStorageBackend

        public FaceStorageBackend()
    • Method Detail

      • getNames

        public Set<String> getNames()
        Get all known faces
        Returns:
        Set of all known faces (names only)
      • register

        public boolean register​(String rawname,
                                float[][] alldata,
                                boolean replace)
        Register/store new face.
        Parameters:
        rawname - Name of the face, needs to be unique.
        alldata - Face detection model data to store.
        replace - Allow replacing an already registered face (based on name). If false and it's still attempted, the method returns false and does nothing.
        Returns:
        If registering was successful.
        See Also:
        register(String, float[][]), register(String, float[])
      • extendRegistered

        public boolean extendRegistered​(String rawname,
                                        float[] alldata,
                                        boolean add)
        Adds 1D face model to existing 2D face model to improve accuracy.
        Parameters:
        rawname - Name of the face, needs to be unique.
        alldata - 1D face detection model data to store
        add - If the face doesn't already exist, can we create it?
        Returns:
        If registering was successful.
      • get

        public float[][] get​(String name)
        Load 2D face model from storage.
        Parameters:
        name - The name of the face to load.
        Returns:
        The face model.
      • delete

        public boolean delete​(String name)
        Delete all references to a face.
        Parameters:
        name - The face to delete.
        Returns:
        If deletion was successful.
      • getNamesInternal

        protected abstract Set<String> getNamesInternal()
        Get all known faces
        Returns:
        Set of all known faces (names only)
      • registerInternal

        protected abstract boolean registerInternal​(String name,
                                                    String data,
                                                    boolean duplicate)
        Register/store new face.
        Parameters:
        name - Name of the face, needs to be unique.
        data - Face detection model data to store.
        duplicate - Only true if we are adding a duplicate and want to replace the saved one.
        Returns:
        If registering was successful.
      • getInternal

        protected abstract String getInternal​(String name)
        Load 2D face model from storage.
        Parameters:
        name - The name of the face to load.
        Returns:
        The face model.
      • deleteInternal

        protected abstract boolean deleteInternal​(String name)
        Delete all references to a face.
        Parameters:
        name - The face to delete.
        Returns:
        If deletion was successful.