|
@@ -27,7 +27,10 @@ import { ReferenceImage } from './reference-image';
|
27
|
27
|
import { IllegalArgumentError, IllegalOperationError } from '../../utils/errors';
|
28
|
28
|
|
29
|
29
|
/** Default capacity of a Reference Image Database */
|
30
|
|
-const DEFAULT_CAPACITY = 100;
|
|
30
|
+const DEFAULT_CAPACITY = 100; // this number should exceed normal usage
|
|
31
|
+ // XXX this number may be changed (is 100 too conservative?)
|
|
32
|
+ // further testing is needed to verify the appropriateness of this number;
|
|
33
|
+ // it depends on the images, on the keypoint descriptors, and even on the target devices
|
31
|
34
|
|
32
|
35
|
/** Generate a unique name for a reference image */
|
33
|
36
|
const generateUniqueName = () => 'target-' + Math.random().toString(16).substr(2);
|
|
@@ -88,18 +91,17 @@ export class ReferenceImageDatabase implements Iterable<ReferenceImage>
|
88
|
91
|
|
89
|
92
|
/**
|
90
|
93
|
* Maximum number of elements
|
|
94
|
+ * Increasing the capacity is considered experimental
|
91
|
95
|
*/
|
92
|
|
- /*
|
93
|
96
|
set capacity(value: number)
|
94
|
97
|
{
|
95
|
98
|
const capacity = Math.max(0, value | 0);
|
96
|
99
|
|
97
|
100
|
if(this.count > capacity)
|
98
|
|
- throw new IllegalArgumentError(`Can't set the capacity of the database to ${this._capacity}: it currently stores ${this.count} entries`);
|
|
101
|
+ throw new IllegalArgumentError(`Can't set the capacity of the database to ${capacity}: it currently stores ${this.count} entries`);
|
99
|
102
|
|
100
|
103
|
this._capacity = capacity;
|
101
|
104
|
}
|
102
|
|
- */
|
103
|
105
|
|
104
|
106
|
/**
|
105
|
107
|
* Iterates over the collection
|