Search in sources :

Example 1 with ConfigRecognitionNister2006

use of boofcv.abst.scene.nister2006.ConfigRecognitionNister2006 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);
    }
}
Also used : FeatureSceneRecognitionNister2006(boofcv.abst.scene.nister2006.FeatureSceneRecognitionNister2006) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) ConfigRecognitionNister2006(boofcv.abst.scene.nister2006.ConfigRecognitionNister2006) RecognitionNearestNeighborInvertedFile(boofcv.alg.scene.ann.RecognitionNearestNeighborInvertedFile) InvertedFile(boofcv.alg.scene.bow.InvertedFile) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

ConfigRecognitionNister2006 (boofcv.abst.scene.nister2006.ConfigRecognitionNister2006)1 FeatureSceneRecognitionNister2006 (boofcv.abst.scene.nister2006.FeatureSceneRecognitionNister2006)1 RecognitionNearestNeighborInvertedFile (boofcv.alg.scene.ann.RecognitionNearestNeighborInvertedFile)1 InvertedFile (boofcv.alg.scene.bow.InvertedFile)1 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1