T
- the type of local featurepublic class MemoryLocalFeatureList<T extends LocalFeature<?,?>> extends ArrayList<T> implements LocalFeatureList<T>
Modifier and Type | Field and Description |
---|---|
protected int |
cached_veclen |
modCount
BINARY_HEADER
Constructor and Description |
---|
MemoryLocalFeatureList()
Construct an empty feature list
|
MemoryLocalFeatureList(Collection<? extends T> c)
Construct a local feature list from the given collection of local
features.
|
MemoryLocalFeatureList(int veclen)
Construct an empty list with the given feature-vector length.
|
MemoryLocalFeatureList(int veclen,
int initialCapacity)
Construct an empty list with the given feature-vector length and
pre-allocate the underlying array with space for initialCapacity local
features.
|
Modifier and Type | Method and Description |
---|---|
String |
asciiHeader()
Header for ascii output.
|
<Q> Q[] |
asDataArray(Q[] a)
Get the feature-vector data of the list as a two-dimensional array of
data.
|
byte[] |
binaryHeader()
Header for binary output.
|
MemoryLocalFeatureList<T> |
filter(LocationFilter locationFilter)
Create a new list by applying a
LocationFilter to all the
elements of this list. |
MemoryLocalFeatureList<T> |
randomSubList(int nelem)
Extract a sublist made up of nelem elements from the this list.
|
static <T extends LocalFeature<?,?>> |
read(BufferedInputStream stream,
Class<T> clz)
Create a MemoryLocalFeatureList by reading all the local features from
the specified stream.
|
static <T extends LocalFeature<?,?>> |
read(File keypointFile,
Class<T> clz)
Create a MemoryLocalFeatureList by reading all the local features from
the specified file.
|
static <T extends LocalFeature<?,?>> |
read(InputStream stream,
Class<T> clz)
Create a MemoryLocalFeatureList by reading all the local features from
the specified stream.
|
static <T extends LocalFeature<?,?>> |
readNoHeader(DataInput in,
Class<T> clz)
Create a MemoryLocalFeatureList by reading all the local features from
the specified
DataInput . |
void |
resetVecLength()
Reset the internal feature vector length to the length of the first
feature.
|
MemoryLocalFeatureList<T> |
subList(int fromIndex,
int toIndex) |
int |
vecLength()
Get the length of the feature-vectors of each local feature if they are
constant.
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
protected int cached_veclen
public MemoryLocalFeatureList()
public MemoryLocalFeatureList(int veclen)
veclen
- the expected length of the feature vectors of each local
feature.public MemoryLocalFeatureList(Collection<? extends T> c)
c
- Collection of local feature to add to the list instance.public MemoryLocalFeatureList(int veclen, int initialCapacity)
veclen
- the expected length of the feature vectors of each local
feature.initialCapacity
- the initial capacity of the list.public static <T extends LocalFeature<?,?>> MemoryLocalFeatureList<T> read(File keypointFile, Class<T> clz) throws IOException
T
- the type of local featurekeypointFile
- the file from which to read the featuresclz
- the class of local featureIOException
- if an error occurs reading the filepublic static <T extends LocalFeature<?,?>> MemoryLocalFeatureList<T> read(InputStream stream, Class<T> clz) throws IOException
T
- the type of local featurestream
- the input stream from which to read the featuresclz
- the class of local featureIOException
- if an error occurs reading the filepublic static <T extends LocalFeature<?,?>> MemoryLocalFeatureList<T> read(BufferedInputStream stream, Class<T> clz) throws IOException
T
- the type of local featurestream
- the input stream from which to read the featuresclz
- the class of local featureIOException
- if an error occurs reading the filepublic static <T extends LocalFeature<?,?>> MemoryLocalFeatureList<T> readNoHeader(DataInput in, Class<T> clz) throws IOException
DataInput
. Reading of the header is skipped, and it
is assumed that the data is in binary format.T
- the type of local featurein
- the data input from which to read the featuresclz
- the class of local featureIOException
- if an error occurs reading the filepublic <Q> Q[] asDataArray(Q[] a)
LocalFeatureList
must be compatible with the data type of the features themselves.
asDataArray
in interface LocalFeatureList<T extends LocalFeature<?,?>>
Q
- the data typea
- the array to fillpublic MemoryLocalFeatureList<T> randomSubList(int nelem)
RandomisableList
randomSubList
in interface RandomisableList<T extends LocalFeature<?,?>>
nelem
- number of elements to extractpublic void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
out
- sink to write toIOException
- an error writing to outpublic byte[] binaryHeader()
WriteableBinary
binaryHeader
in interface WriteableBinary
public String asciiHeader()
WriteableASCII
asciiHeader
in interface WriteableASCII
public int vecLength()
LocalFeatureList
vecLength
in interface LocalFeatureList<T extends LocalFeature<?,?>>
public void resetVecLength()
public MemoryLocalFeatureList<T> filter(LocationFilter locationFilter)
LocationFilter
to all the
elements of this list. Only items which are accepted by the filter will
be added to the new list.locationFilter
- the location filterpublic MemoryLocalFeatureList<T> subList(int fromIndex, int toIndex)
subList
in interface List<T extends LocalFeature<?,?>>
subList
in interface LocalFeatureList<T extends LocalFeature<?,?>>
subList
in class ArrayList<T extends LocalFeature<?,?>>