Package boofcv.alg.feature.describe.llah
Class LlahHasher
java.lang.Object
boofcv.alg.feature.describe.llah.LlahHasher
- Direct Known Subclasses:
LlahHasher.Affine
,LlahHasher.CrossRatio
Functions related to computing the hash values of a LLAH feature. This is done by looking at the invariant
geometry between points and computing a hash function from their values.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Recommended K from the paperstatic int
The recommended hash size from the paperprotected double[]
Defines the look up table. -
Constructor Summary
ModifierConstructorDescriptionprotected
LlahHasher
(long hashK, int hashSize) Configures the hash function. -
Method Summary
Modifier and TypeMethodDescriptionvoid
computeHash
(List<Point2D_F64> points, LlahFeature output) Computes the hashcode and invariant values.protected abstract double
computeInvariant
(Combinations<Point2D_F64> combinator) Computes the invariants given the set of pointsvoid
computeInvariants
(List<Point2D_F64> points, double[] invariants, int offset) Stores the computed invariants into an arrayint
discretize
(double invariant) Computes the discrete value from the continuous valued invariantprotected abstract int
Number of points required to compute the invariantsint
getNumberOfInvariants
(int numPoints) Returns the number of invariants given the number of points.int
Returns the number of possible valuesvoid
learnDiscretization
(int[] histogram, int histLength, double histMaxValue, int numDiscrete) Create a lookup table by sorting then sampling the invariants.
-
Field Details
-
DEFAULT_HASH_K
public static int DEFAULT_HASH_KRecommended K from the paper -
DEFAULT_HASH_SIZE
public static int DEFAULT_HASH_SIZEThe recommended hash size from the paper -
samples
protected double[] samplesDefines the look up table. A binary search is used to effectively find the index of a value
-
-
Constructor Details
-
LlahHasher
protected LlahHasher(long hashK, int hashSize) Configures the hash function. See JavaDoc for info on variables
-
-
Method Details
-
getNumberOfInvariants
public int getNumberOfInvariants(int numPoints) Returns the number of invariants given the number of points.- Parameters:
numPoints
- Number of points the hash function is computed from- Returns:
- Number of invariants the feature will have
-
computeHash
Computes the hashcode and invariant values. Stores result in output- Parameters:
points
- Set of points. Must be ≥ 4.
-
computeInvariants
Stores the computed invariants into an array -
getInvariantSampleSize
protected abstract int getInvariantSampleSize()Number of points required to compute the invariants -
computeInvariant
Computes the invariants given the set of points -
discretize
public int discretize(double invariant) Computes the discrete value from the continuous valued invariant -
learnDiscretization
public void learnDiscretization(int[] histogram, int histLength, double histMaxValue, int numDiscrete) Create a lookup table by sorting then sampling the invariants. This will have the desired property of having a denser set of points where there is a higher density of values. A histogram is required instead of raw values because it becomes intractable quickly for even only a few documents if it's an array..- Parameters:
histogram
- Histogram of invariant values from 0 to maxValuehistLength
- Histogram length.histMaxValue
- The maximum value in the histogramnumDiscrete
- Number of possible discrete values. Larger values indicate higher resolution in discretation
-
getNumValues
public int getNumValues()Returns the number of possible values
-