use of boofcv.abst.scene.nister2006.FeatureSceneRecognitionNister2006 in project BoofCV by lessthanoptimal.
the class TestRecognitionIO method save_load_FeatureToScene_Nister2006.
/**
* Very basic test. Mostly just checks to see if things blow up or not
*/
@Test
void save_load_FeatureToScene_Nister2006() {
File dir = new File(System.getProperty("java.io.tmpdir"), "feature_to_scene");
try {
var config = new ConfigFeatureToSceneRecognition();
config.typeRecognize = ConfigFeatureToSceneRecognition.Type.NISTER_2006;
ImageType<GrayU8> imageType = ImageType.SB_U8;
var original = FactorySceneRecognition.createFeatureToScene(config, imageType);
((FeatureSceneRecognitionNister2006<TupleDesc_F64>) original.getRecognizer()).setDatabase(createDefaultNister2006());
RecognitionIO.saveFeatureToScene(original, dir);
WrapFeatureToSceneRecognition<GrayU8, TupleDesc_F64> found = RecognitionIO.loadFeatureToScene(dir, imageType);
// Check a some things to make sure it actually loaded
FeatureSceneRecognitionNister2006<TupleDesc_F64> foundRecognizer = found.getRecognizer();
assertEquals(20, foundRecognizer.getDatabase().getImagesDB().size);
assertEquals(5, foundRecognizer.getTree().nodes.size());
} finally {
// clean up
if (dir.exists())
UtilIO.deleteRecursive(dir);
}
}
use of boofcv.abst.scene.nister2006.FeatureSceneRecognitionNister2006 in project BoofCV by lessthanoptimal.
the class TestRecognitionIO method save_load_nister2006.
/**
* Very basic test. Mostly just checks to see if things blow up or not
*/
@Test
void save_load_nister2006() {
File dir = new File(System.getProperty("java.io.tmpdir"), "nister2006");
try {
var config = new ConfigRecognitionNister2006();
var original = new FeatureSceneRecognitionNister2006<>(config, () -> new TupleDesc_F64(10));
original.setDatabase(createDefaultNister2006());
RecognitionIO.saveNister2006(original, dir);
var found = new FeatureSceneRecognitionNister2006<>(config, () -> new TupleDesc_F64(10));
RecognitionIO.loadNister2006(dir, found);
// Check a some things to make sure it actually loaded
assertEquals(20, found.getDatabase().getImagesDB().size);
assertEquals(5, found.getTree().nodes.size());
} finally {
// clean up
if (dir.exists())
UtilIO.deleteRecursive(dir);
}
}
Aggregations