Search in sources :

Example 1 with ConfigSimilarImagesSceneRecognition

use of boofcv.alg.similar.ConfigSimilarImagesSceneRecognition in project BoofCV by lessthanoptimal.

the class ExampleMultiViewSparseReconstruction method similarImagesFromUnsorted.

/**
 * Assumes that the images are complete unsorted
 */
private void similarImagesFromUnsorted() {
    System.out.println("----------------------------------------------------------------------------");
    System.out.println("### Creating Similar Images from unordered images");
    var config = new ConfigSimilarImagesSceneRecognition();
    final var similarImages = FactorySceneReconstruction.createSimilarImages(config, ImageType.SB_U8);
    similarImages.setVerbose(System.out, BoofMiscOps.hashSet(BoofVerbose.RECURSIVE));
    // Track features across the entire sequence and save the results
    BoofMiscOps.profile(() -> {
        for (int frameId = 0; frameId < imageFiles.size(); frameId++) {
            String filePath = imageFiles.get(frameId);
            GrayU8 frame = UtilImageIO.loadImage(filePath, GrayU8.class);
            Objects.requireNonNull(frame, "Failed to load image");
            String viewID = frameId + "";
            similarImages.addImage(viewID, frame);
            // Everything maps to the same camera
            if (frameId == 0)
                dbCams.addCameraCanonical(frame.width, frame.height, 60.0);
            dbCams.addView(viewID, 0);
        }
        similarImages.fixate();
    }, "Finding Similar");
    this.dbSimilar = similarImages;
}
Also used : ConfigSimilarImagesSceneRecognition(boofcv.alg.similar.ConfigSimilarImagesSceneRecognition) GrayU8(boofcv.struct.image.GrayU8)

Aggregations

ConfigSimilarImagesSceneRecognition (boofcv.alg.similar.ConfigSimilarImagesSceneRecognition)1 GrayU8 (boofcv.struct.image.GrayU8)1