Search in sources :

Example 1 with BundleCameraProjective

use of boofcv.alg.geo.bundle.cameras.BundleCameraProjective in project BoofCV by lessthanoptimal.

the class SceneStructureProjective method initialize.

/**
 * Initialization with the assumption that a {@link boofcv.alg.geo.bundle.cameras.BundleCameraProjective}
 * is used for all views.
 *
 * @param totalViews Number of views
 * @param totalPoints Number of points
 */
public void initialize(int totalViews, int totalPoints) {
    this.initialize(1, totalViews, totalPoints);
    setCamera(0, true, new BundleCameraProjective());
    for (int viewIdx = 0; viewIdx < views.size; viewIdx++) {
        connectViewToCamera(viewIdx, 0);
    }
}
Also used : BundleCameraProjective(boofcv.alg.geo.bundle.cameras.BundleCameraProjective)

Example 2 with BundleCameraProjective

use of boofcv.alg.geo.bundle.cameras.BundleCameraProjective in project BoofCV by lessthanoptimal.

the class TestCodecSceneStructureProjective method createSceneH.

static SceneStructureProjective createSceneH(Random rand) {
    SceneStructureProjective out = new SceneStructureProjective(true);
    out.initialize(2, 4, 5);
    out.setCamera(0, true, new BundleCameraProjective());
    // out.setCamera(1,true,new BundleCameraProjective());
    out.setCamera(1, false, new CameraPinhole(100, 110, 0.0001, rand.nextGaussian() / 100, rand.nextGaussian() / 100, 1, 1));
    for (int i = 0; i < 5; i++) {
        double w = rand.nextDouble() * 0.1;
        out.setPoint(i, i + 1, i + 2 * rand.nextGaussian(), 2 * i - 3 * rand.nextGaussian(), 0.9 + w);
    }
    for (int i = 0; i < 4; i++) {
        boolean fixed = i % 2 == 0;
        DMatrixRMaj P = new DMatrixRMaj(3, 4);
        if (fixed) {
            for (int j = 0; j < 12; j++) {
                P.data[j] = 10.1 + j * 0.2;
            }
        } else
            RandomMatrices_DDRM.fillUniform(P, rand);
        out.setView(i, fixed, P, width, height);
        out.views.data[i].camera = i / 2;
    }
    // Assign first point to all views then the other points to just one view
    for (int i = 0; i < 4; i++) {
        out.points.data[0].views.add(i);
    }
    for (int i = 1; i < out.points.size; i++) {
        out.points.data[i].views.add(i - 1);
    }
    return out;
}
Also used : SceneStructureProjective(boofcv.abst.geo.bundle.SceneStructureProjective) BundleCameraProjective(boofcv.alg.geo.bundle.cameras.BundleCameraProjective) DMatrixRMaj(org.ejml.data.DMatrixRMaj) CameraPinhole(boofcv.struct.calib.CameraPinhole)

Example 3 with BundleCameraProjective

use of boofcv.alg.geo.bundle.cameras.BundleCameraProjective in project BoofCV by lessthanoptimal.

the class TestCodecSceneStructureProjective method createScene3D.

static SceneStructureProjective createScene3D(Random rand) {
    SceneStructureProjective out = new SceneStructureProjective(false);
    out.initialize(2, 4, 5);
    out.setCamera(0, true, new BundleCameraProjective());
    // out.setCamera(1,true,new BundleCameraProjective());
    out.setCamera(1, false, new CameraPinhole(100, 110, 0.0001, rand.nextGaussian() / 100, rand.nextGaussian() / 100, 1, 1));
    for (int i = 0; i < 5; i++) {
        out.setPoint(i, i + 1, i + 2 * rand.nextGaussian(), 2 * i - 3 * rand.nextGaussian());
    }
    for (int i = 0; i < 4; i++) {
        boolean fixed = i % 2 == 0;
        DMatrixRMaj P = new DMatrixRMaj(3, 4);
        if (fixed) {
            for (int j = 0; j < 12; j++) {
                P.data[j] = 0.1 + j * 0.2;
            }
        } else
            RandomMatrices_DDRM.fillUniform(P, rand);
        out.setView(i, fixed, P, width, height);
        out.views.data[i].camera = i / 2;
    }
    // Assign first point to all views then the other points to just one view
    for (int i = 0; i < 4; i++) {
        out.points.data[0].views.add(i);
    }
    for (int i = 1; i < out.points.size; i++) {
        out.points.data[i].views.add(i - 1);
    }
    return out;
}
Also used : SceneStructureProjective(boofcv.abst.geo.bundle.SceneStructureProjective) BundleCameraProjective(boofcv.alg.geo.bundle.cameras.BundleCameraProjective) DMatrixRMaj(org.ejml.data.DMatrixRMaj) CameraPinhole(boofcv.struct.calib.CameraPinhole)

Aggregations

BundleCameraProjective (boofcv.alg.geo.bundle.cameras.BundleCameraProjective)3 SceneStructureProjective (boofcv.abst.geo.bundle.SceneStructureProjective)2 CameraPinhole (boofcv.struct.calib.CameraPinhole)2 DMatrixRMaj (org.ejml.data.DMatrixRMaj)2