Search in sources :

Example 16 with Homography2D_F64

use of georegression.struct.homography.Homography2D_F64 in project BoofCV by lessthanoptimal.

the class TestPixelTransformHomography_F32 method constructor_64.

@Test
public void constructor_64() {
    Homography2D_F64 a = new Homography2D_F64(1, 2, 3, 4, 5, 6, 7, 8, 9);
    PixelTransformHomography_F32 alg = new PixelTransformHomography_F32();
    alg.set(a);
    alg.compute(2, 3);
    Point2D_F64 p = new Point2D_F64(2, 3);
    Point2D_F64 expected = new Point2D_F64();
    HomographyPointOps_F64.transform(a, p, expected);
    assertEquals(expected.x, alg.distX, 1e-4);
    assertEquals(expected.y, alg.distY, 1e-4);
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) Homography2D_F64(georegression.struct.homography.Homography2D_F64) Test(org.junit.Test)

Example 17 with Homography2D_F64

use of georegression.struct.homography.Homography2D_F64 in project BoofCV by lessthanoptimal.

the class UtilImageMotion method createPixelTransform.

/**
 * Given a motion model create a PixelTransform used to distort the image
 *
 * @param transform Motion transform
 * @return PixelTransform_F32 used to distort the image
 */
public static PixelTransform2_F32 createPixelTransform(InvertibleTransform transform) {
    PixelTransform2_F32 pixelTran;
    if (transform instanceof Homography2D_F64) {
        Homography2D_F32 t = ConvertFloatType.convert((Homography2D_F64) transform, null);
        pixelTran = new PixelTransformHomography_F32(t);
    } else if (transform instanceof Homography2D_F32) {
        pixelTran = new PixelTransformHomography_F32((Homography2D_F32) transform);
    } else if (transform instanceof Affine2D_F64) {
        Affine2D_F32 t = UtilAffine.convert((Affine2D_F64) transform, null);
        pixelTran = new PixelTransformAffine_F32(t);
    } else if (transform instanceof Affine2D_F32) {
        pixelTran = new PixelTransformAffine_F32((Affine2D_F32) transform);
    } else {
        throw new RuntimeException("Unknown model type");
    }
    return pixelTran;
}
Also used : Affine2D_F64(georegression.struct.affine.Affine2D_F64) Affine2D_F32(georegression.struct.affine.Affine2D_F32) PixelTransformHomography_F32(boofcv.alg.distort.PixelTransformHomography_F32) Homography2D_F32(georegression.struct.homography.Homography2D_F32) PixelTransformAffine_F32(boofcv.alg.distort.PixelTransformAffine_F32) Homography2D_F64(georegression.struct.homography.Homography2D_F64) PixelTransform2_F32(boofcv.struct.distort.PixelTransform2_F32)

Example 18 with Homography2D_F64

use of georegression.struct.homography.Homography2D_F64 in project BoofCV by lessthanoptimal.

the class FactoryStitchingTransform method createAffine_F64.

public static StitchingTransform<Affine2D_F64> createAffine_F64() {
    return new StitchingTransform<Affine2D_F64>() {

        Affine2D_F32 input_F32 = new Affine2D_F32();

        @Override
        public PixelTransform2_F32 convertPixel(Affine2D_F64 input, PixelTransform2_F32 output) {
            ConvertFloatType.convert(input, input_F32);
            if (output != null) {
                ((PixelTransformAffine_F32) output).set(input_F32);
            } else {
                PixelTransformAffine_F32 a = new PixelTransformAffine_F32();
                a.set(input_F32);
                output = a;
            }
            return output;
        }

        @Override
        public Homography2D_F64 convertH(Affine2D_F64 input, Homography2D_F64 output) {
            if (output == null)
                output = new Homography2D_F64();
            output.set(input.a11, input.a12, input.tx, input.a21, input.a22, input.ty, 0, 0, 1);
            return output;
        }
    };
}
Also used : Affine2D_F64(georegression.struct.affine.Affine2D_F64) Affine2D_F32(georegression.struct.affine.Affine2D_F32) PixelTransformAffine_F32(boofcv.alg.distort.PixelTransformAffine_F32) Homography2D_F64(georegression.struct.homography.Homography2D_F64) PixelTransform2_F32(boofcv.struct.distort.PixelTransform2_F32)

Aggregations

Homography2D_F64 (georegression.struct.homography.Homography2D_F64)18 Point2D_F64 (georegression.struct.point.Point2D_F64)5 GrayF32 (boofcv.struct.image.GrayF32)4 BufferedImage (java.awt.image.BufferedImage)4 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)3 ImageGridPanel (boofcv.gui.image.ImageGridPanel)3 MediaManager (boofcv.io.MediaManager)3 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 DefaultMediaManager (boofcv.io.wrapper.DefaultMediaManager)3 AssociatedPair (boofcv.struct.geo.AssociatedPair)3 Planar (boofcv.struct.image.Planar)3 ModelManagerHomography2D_F64 (georegression.fitting.homography.ModelManagerHomography2D_F64)3 Affine2D_F64 (georegression.struct.affine.Affine2D_F64)3 PlToGrayMotion2D (boofcv.abst.sfm.d2.PlToGrayMotion2D)2 PixelTransformAffine_F32 (boofcv.alg.distort.PixelTransformAffine_F32)2 PixelTransformHomography_F32 (boofcv.alg.distort.PixelTransformHomography_F32)2 DistanceHomographySq (boofcv.alg.geo.robust.DistanceHomographySq)2 GenerateHomographyLinear (boofcv.alg.geo.robust.GenerateHomographyLinear)2 PixelTransform2_F32 (boofcv.struct.distort.PixelTransform2_F32)2 Affine2D_F32 (georegression.struct.affine.Affine2D_F32)2