Search in sources :

Example 6 with ConfigDisparityBMBest5

use of boofcv.factory.disparity.ConfigDisparityBMBest5 in project BoofCV by lessthanoptimal.

the class TestMultiBaselineStereoIndependent method handleOneCameraManyViews.

/**
 * In this scene there is only one camera for several views
 */
@Test
void handleOneCameraManyViews() {
    var scene = new SceneStructureMetric(true);
    scene.initialize(1, 3, 0);
    scene.setCamera(0, true, new CameraPinholeBrown().fsetK(30, 30, 0, 25, 25, 50, 50));
    for (int i = 0; i < 3; i++) {
        scene.setView(i, 0, true, eulerXyz(i, 0, 0, 0, 0, 0, null));
    }
    var alg = new MultiBaselineStereoIndependent<>(ImageType.SB_F32);
    var configDisp = new ConfigDisparityBMBest5();
    configDisp.errorType = DisparityError.SAD;
    configDisp.disparityRange = 5;
    alg.stereoDisparity = FactoryStereoDisparity.blockMatchBest5(configDisp, GrayF32.class, GrayF32.class);
    List<GrayF32> images = new ArrayList<>();
    TIntObjectMap<String> sbaIndexToViewID = new TIntObjectHashMap<>();
    for (int i = 0; i < 3; i++) {
        images.add(new GrayF32(50, 50));
        sbaIndexToViewID.put(i, i + "");
    }
    alg.lookUpImages = new MockLookUp(images);
    // Override so that it will always be happy
    alg.performFusion = new MultiBaselineDisparityMedian() {

        @Override
        public boolean process(GrayF32 disparity) {
            return true;
        }
    };
    // just see if it blows up
    assertTrue(alg.process(scene, 0, DogArray_I32.array(1, 2), sbaIndexToViewID::get));
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) ConfigDisparityBMBest5(boofcv.factory.disparity.ConfigDisparityBMBest5) ArrayList(java.util.ArrayList) SceneStructureMetric(boofcv.abst.geo.bundle.SceneStructureMetric) GrayF32(boofcv.struct.image.GrayF32) TIntObjectHashMap(gnu.trove.map.hash.TIntObjectHashMap) Test(org.junit.jupiter.api.Test)

Aggregations

ConfigDisparityBMBest5 (boofcv.factory.disparity.ConfigDisparityBMBest5)6 CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)4 GrayF32 (boofcv.struct.image.GrayF32)4 RectifiedPairPanel (boofcv.gui.stereo.RectifiedPairPanel)3 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 GrayU8 (boofcv.struct.image.GrayU8)3 TIntObjectHashMap (gnu.trove.map.hash.TIntObjectHashMap)3 BufferedImage (java.awt.image.BufferedImage)3 ArrayList (java.util.ArrayList)3 SceneStructureMetric (boofcv.abst.geo.bundle.SceneStructureMetric)2 DMatrixRMaj (org.ejml.data.DMatrixRMaj)2 ConfigSpeckleFilter (boofcv.abst.disparity.ConfigSpeckleFilter)1 LensDistortionBrown (boofcv.alg.distort.brown.LensDistortionBrown)1 DisparityParameters (boofcv.alg.mvs.DisparityParameters)1 MultiBaselineStereoIndependent (boofcv.alg.mvs.MultiBaselineStereoIndependent)1 SceneWorkingGraph (boofcv.alg.structure.SceneWorkingGraph)1 ConfigDisparitySGM (boofcv.factory.disparity.ConfigDisparitySGM)1 ListDisplayPanel (boofcv.gui.ListDisplayPanel)1 ControlPanelDisparityDense (boofcv.gui.controls.ControlPanelDisparityDense)1 LookUpImageFilesByIndex (boofcv.io.image.LookUpImageFilesByIndex)1