Search in sources :

Example 6 with Se3_F32

use of georegression.struct.se.Se3_F32 in project BoofCV by lessthanoptimal.

the class TestMultiCameraToEquirectangular method all.

@Test
public void all() {
    MultiCameraToEquirectangular<GrayF32> alg = createAlgorithm();
    alg.addCamera(new Se3_F32(), new HelperDistortion(), inputWidth, inputHeight);
    Se3_F32 cam2_to_1 = new Se3_F32();
    ConvertRotation3D_F32.eulerToMatrix(EulerType.XYZ, GrlConstants.F_PI, 0, 0, cam2_to_1.R);
    alg.addCamera(cam2_to_1, new HelperDistortion(), inputWidth, inputHeight);
    GrayF32 image0 = new GrayF32(inputWidth, inputHeight);
    GrayF32 image1 = new GrayF32(inputWidth, inputHeight);
    ImageMiscOps.fill(image0, 200);
    ImageMiscOps.fill(image1, 100);
    List<GrayF32> images = new ArrayList<>();
    images.add(image0);
    images.add(image1);
    alg.render(images);
    GrayF32 found = alg.getRenderedImage();
    double totalError = 0;
    for (int y = 0; y < equiHeight; y++) {
        for (int x = 0; x < equiWidth; x++) {
            if (y < equiHeight / 2) {
                totalError += Math.abs(200 - found.get(x, y));
            } else {
                totalError += Math.abs(100 - found.get(x, y));
            }
        }
    }
    double errorFraction = totalError / (equiWidth * equiHeight * 100);
    assertTrue(errorFraction < 0.05);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ArrayList(java.util.ArrayList) Se3_F32(georegression.struct.se.Se3_F32) Test(org.junit.Test)

Aggregations

Se3_F32 (georegression.struct.se.Se3_F32)6 GrayF32 (boofcv.struct.image.GrayF32)5 Test (org.junit.Test)4 GrayU8 (boofcv.struct.image.GrayU8)2 Planar (boofcv.struct.image.Planar)2 ArrayList (java.util.ArrayList)2 LensDistortionWideFOV (boofcv.alg.distort.LensDistortionWideFOV)1 MultiCameraToEquirectangular (boofcv.alg.distort.spherical.MultiCameraToEquirectangular)1 LensDistortionUniversalOmni (boofcv.alg.distort.universal.LensDistortionUniversalOmni)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 CameraUniversalOmni (boofcv.struct.calib.CameraUniversalOmni)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 FMatrixRMaj (org.ejml.data.FMatrixRMaj)1