Package boofcv.io.recognition
Class RecognitionIO
java.lang.Object
boofcv.io.recognition.RecognitionIO
Reading and writing data structures related to recognition.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <Image extends ImageBase<Image>,
TD extends TupleDesc<TD>>
WrapFeatureToSceneRecognition<Image,TD> downloadDefaultSceneRecognition
(File destination, ImageType<Image> imageType) Downloads then loads the pre-built default scene recognition model.static <TD extends TupleDesc<TD>>
voidloadBin
(InputStream in, RecognitionVocabularyTreeNister2006<TD> db) LoadsRecognitionVocabularyTreeNister2006
from a binary format.loadDictionaryBin
(File file) static <Image extends ImageBase<Image>,
TD extends TupleDesc<TD>>
WrapFeatureToSceneRecognition<Image,TD> loadFeatureToScene
(File dir, ImageType<Image> imageType) static void
static void
static <TD extends TupleDesc<TD>>
voidloadNister2006
(File dir, FeatureSceneRecognitionNister2006<TD> recognizer) static <TD extends TupleDesc<TD>>
HierarchicalVocabularyTree<TD>loadTreeBin
(File file, @Nullable HierarchicalVocabularyTree<TD> tree) static <TD extends TupleDesc<TD>>
voidloadTreeBin
(File file, RecognitionVocabularyTreeNister2006<TD> db) static <TD extends TupleDesc<TD>>
HierarchicalVocabularyTree<TD>loadTreeBin
(InputStream in, @Nullable HierarchicalVocabularyTree<TD> tree) static <TD extends TupleDesc<TD>>
voidreadBin
(TD tuple, DataInputStream in) static <TD extends TupleDesc<TD>>
voidsaveBin
(RecognitionVocabularyTreeNister2006<TD> db, OutputStream out) SavesRecognitionVocabularyTreeNister2006
to a binary format.static <TD extends TupleDesc<TD>>
voidsaveBin
(HierarchicalVocabularyTree<TD> tree, File file) static <TD extends TupleDesc<TD>>
voidsaveDictionaryBin
(List<TD> dictionary, int dof, Class<TD> descType, File file) static <TD extends TupleDesc<TD>>
voidsaveDictionaryBin
(List<TD> dictionary, int dof, Class<TD> descType, OutputStream out) Saves a TupleDesc dictionary in a binary formatstatic <TD extends TupleDesc<TD>>
voidsaveFeatureToScene
(WrapFeatureToSceneRecognition<?, TD> def, File dir) SavesWrapFeatureToSceneRecognition
to disk inside of the specified directorystatic void
static void
static <TD extends TupleDesc<TD>>
voidsaveNister2006
(FeatureSceneRecognitionNister2006<TD> def, File dir) SavesFeatureSceneRecognitionNister2006
to disk inside of the specified directorystatic <TD extends TupleDesc<TD>>
voidsaveTreeBin
(RecognitionVocabularyTreeNister2006<TD> db, File file) static <TD extends TupleDesc<TD>>
voidsaveTreeBin
(HierarchicalVocabularyTree<TD> tree, OutputStream out) Saves the tree in binary format.static <TD extends TupleDesc<TD>>
voidwriteBin
(TD tuple, DataOutputStream dout)
-
Field Details
-
CONFIG_NAME
- See Also:
-
IMAGE_ID_NAME
- See Also:
-
DATABASE_NAME
- See Also:
-
DICTIONARY_NAME
- See Also:
-
INVERTED_NAME
- See Also:
-
-
Constructor Details
-
RecognitionIO
public RecognitionIO()
-
-
Method Details
-
downloadDefaultSceneRecognition
public static <Image extends ImageBase<Image>,TD extends TupleDesc<TD>> WrapFeatureToSceneRecognition<Image,TD> downloadDefaultSceneRecognition(File destination, ImageType<Image> imageType) Downloads then loads the pre-built default scene recognition model. The image DB will of course be empty. If the decompressed directory already exists then it will skip the download step.- Parameters:
destination
- Where it should download the model toimageType
- Type of image the resulting algorithm will process- Returns:
- A new instance of
SceneRecognition
with an already built model.
-
saveFeatureToScene
public static <TD extends TupleDesc<TD>> void saveFeatureToScene(WrapFeatureToSceneRecognition<?, TD> def, File dir) SavesWrapFeatureToSceneRecognition
to disk inside of the specified directory- Parameters:
def
- What is to be saveddir
- Direction that it is to be saved
-
loadFeatureToScene
public static <Image extends ImageBase<Image>,TD extends TupleDesc<TD>> WrapFeatureToSceneRecognition<Image,TD> loadFeatureToScene(File dir, ImageType<Image> imageType) -
saveNister2006
public static <TD extends TupleDesc<TD>> void saveNister2006(FeatureSceneRecognitionNister2006<TD> def, File dir) SavesFeatureSceneRecognitionNister2006
to disk inside of the specified directory- Parameters:
def
- What is to be saveddir
- Direction that it is to be saved
-
loadNister2006
public static <TD extends TupleDesc<TD>> void loadNister2006(File dir, FeatureSceneRecognitionNister2006<TD> recognizer) - Parameters:
dir
- Directory containing saved graphrecognizer
- (Output) where it's loaded into
-
saveBin
public static <TD extends TupleDesc<TD>> void saveBin(HierarchicalVocabularyTree<TD> tree, File file) -
loadTreeBin
public static <TD extends TupleDesc<TD>> HierarchicalVocabularyTree<TD> loadTreeBin(File file, @Nullable @Nullable HierarchicalVocabularyTree<TD> tree) -
saveDictionaryBin
-
loadDictionaryBin
-
saveNearestNeighborBin
-
loadNearestNeighborBin
-
saveTreeBin
public static <TD extends TupleDesc<TD>> void saveTreeBin(HierarchicalVocabularyTree<TD> tree, OutputStream out) Saves the tree in binary format. The format is described in an ascii header.- Parameters:
tree
- (Input) Tree that's savedout
- (Output) Stream the tree is written to
-
loadTreeBin
public static <TD extends TupleDesc<TD>> HierarchicalVocabularyTree<TD> loadTreeBin(InputStream in, @Nullable @Nullable HierarchicalVocabularyTree<TD> tree) -
saveDictionaryBin
public static <TD extends TupleDesc<TD>> void saveDictionaryBin(List<TD> dictionary, int dof, Class<TD> descType, OutputStream out) Saves a TupleDesc dictionary in a binary format- Parameters:
dictionary
- (Input) Tree that's savedout
- (Output) Stream the tree is written to
-
loadDictionaryBin
-
saveNearestNeighborBin
public static void saveNearestNeighborBin(RecognitionNearestNeighborInvertedFile<?> nn, OutputStream out) -
loadNearestNeighborBin
public static void loadNearestNeighborBin(InputStream in, RecognitionNearestNeighborInvertedFile<?> nn) -
writeBin
public static <TD extends TupleDesc<TD>> void writeBin(TD tuple, DataOutputStream dout) throws IOException - Throws:
IOException
-
readBin
public static <TD extends TupleDesc<TD>> void readBin(TD tuple, DataInputStream in) throws IOException - Throws:
IOException
-
saveTreeBin
public static <TD extends TupleDesc<TD>> void saveTreeBin(RecognitionVocabularyTreeNister2006<TD> db, File file) -
loadTreeBin
public static <TD extends TupleDesc<TD>> void loadTreeBin(File file, RecognitionVocabularyTreeNister2006<TD> db) -
saveBin
public static <TD extends TupleDesc<TD>> void saveBin(RecognitionVocabularyTreeNister2006<TD> db, OutputStream out) SavesRecognitionVocabularyTreeNister2006
to a binary format.- Parameters:
db
- (Input) Structure to be encodedout
- Stream it's written to
-
loadBin
public static <TD extends TupleDesc<TD>> void loadBin(InputStream in, RecognitionVocabularyTreeNister2006<TD> db) LoadsRecognitionVocabularyTreeNister2006
from a binary format.- Parameters:
in
- Input streamdb
- (Ouput) Decoded structure
-