public class LlahOperations extends Object
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.
- 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.
Nested Class Summary
Nested Classes Modifier and Type Class Description
static classUsed to relate observed dots to landmarks in a document
static classDocuments that were found to match observed dots
Constructors Constructor Description
LlahHasher hasher)(int numberOfNeighborsN, int sizeOfCombinationM,Configures the LLAH feature computation
Modifier and Type Method Description
()Forgets all the documents and recycles data
()Computes the maximum number of unique hash code a point can have.
List<Point2D_F64> locations2D)(Creates a new document from the 2D points.
Iterable<List<Point2D_F64>> pointSets, int numDiscrete, int histogramLength, double maxInvariantValue)(Learns the hashing function from the set of point sets
List<Point2D_F64> dots, LlahOperations.FoundDocument output)(Place holder function for the document retrieval in the LLAH paper.
List<Point2D_F64> dots, int minLandmarks, List<LlahOperations.FoundDocument> output)(Looks up all the documents which match observed features.
LlahOperationspublic 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
clearDocumentspublic void clearDocuments()Forgets all the documents and recycles data
learnHashingpublic 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
createDocumentCreates 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.
computeMaxUniqueHashPerPointpublic long computeMaxUniqueHashPerPoint()Computes the maximum number of unique hash code a point can have.
lookupDocumentspublic 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!
lookUpDocumentPlace 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