Class LlahOperations


public class LlahOperations
extends Object
Locally Likely Arrangement Hashing (LLAH) [1] computes a descriptor for a landmark based on the local geometry of neighboring landmarks on the image plane. Originally proposed for document retrieval. These features are either invariant to perspective or affine transforms.

Works by sampling the N neighbors around a point. These ports are sorted in clockwise order. However, it is not known which points should be first so all cyclical permutations of set-N are now found. It is assumed that at least M points in set M are a member of the set used to compute the feature, so all M combinations of points in set-N are found. Then the geometric invariants are computed using set-M.

When describing the documents the hash and invariant values of each point in a document is saved. When looking up documents these features are again computed for all points in view, but then the document type is voted upon and returned.

  1. Nakai, Tomohiro, Koichi Kise, and Masakazu Iwamura. "Use of affine invariants in locally likely arrangement hashing for camera-based document image retrieval." International Workshop on Document Analysis Systems. Springer, Berlin, Heidelberg, 2006.
  • Constructor Details

    • LlahOperations

      public LlahOperations​(int numberOfNeighborsN, int sizeOfCombinationM, LlahHasher hasher)
      Configures the LLAH feature computation
      numberOfNeighborsN - Number of neighbors to be considered
      sizeOfCombinationM - Number of different combinations within the neighbors
      hasher - Computes the hash code
  • Method Details

    • clearDocuments

      public void clearDocuments()
      Forgets all the documents and recycles data
    • learnHashing

      public void learnHashing​(Iterable<List<Point2D_F64>> pointSets, int numDiscrete, int histogramLength, double maxInvariantValue)
      Learns the hashing function from the set of point sets
      pointSets - Point sets. Each set represents one document
      numDiscrete - Number of discrete values the invariant is converted to
      histogramLength - Number of elements in the histogram. 100,000 is recommended
      maxInvariantValue - The maximum number of value an invariant is assumed to have. For affine ~25. Cross Ratio
    • createDocument

      public LlahDocument createDocument​(List<Point2D_F64> locations2D)
      Creates a new document from the 2D points. The document and points are added to the hash table for later retrieval.
      locations2D - Location of points inside the document
      The document which was added to the hash table.
    • computeMaxUniqueHashPerPoint

      public long computeMaxUniqueHashPerPoint()
      Computes the maximum number of unique hash code a point can have.
    • lookupDocuments

      public void lookupDocuments​(List<Point2D_F64> dots, int minLandmarks, List<LlahOperations.FoundDocument> output)
      Looks up all the documents which match observed features.
      dots - Observed feature locations
      minLandmarks - Minimum number of landmarks that are assigned to a document for it to be accepted
      output - Storage for results. WARNING: Results are recycled on next call!
    • lookUpDocument

      public boolean lookUpDocument​(List<Point2D_F64> dots, LlahOperations.FoundDocument output)
      Place holder function for the document retrieval in the LLAH paper. Just throws an exception for now.
      dots - observed dots
      output - storage for found document
      true if successful