Search in sources :

Example 16 with Homography2D_F32

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

the class TestPixelTransformHomography_F32 method constructor_32.

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

Example 17 with Homography2D_F32

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

the class TestPointTransformHomography_F32 method compareToDirect.

/**
 * Directly computes the output
 */
@Test
public void compareToDirect() {
    Point2D_F32 input = new Point2D_F32(50, 60);
    Point2D_F32 output = new Point2D_F32();
    Point2D_F32 expected = new Point2D_F32();
    Homography2D_F32 H = new Homography2D_F32(1, 2, 3, 4, 5, 6, 7, 8, 9);
    HomographyPointOps_F32.transform(H, input, expected);
    PointTransformHomography_F32 alg = new PointTransformHomography_F32();
    alg.set(H);
    alg.compute(input.x, input.y, output);
    assertEquals(expected.x, output.x, 1e-4);
    assertEquals(expected.y, output.y, 1e-4);
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32) Homography2D_F32(georegression.struct.homography.Homography2D_F32) Test(org.junit.Test)

Example 18 with Homography2D_F32

use of georegression.struct.homography.Homography2D_F32 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)

Aggregations

Homography2D_F32 (georegression.struct.homography.Homography2D_F32)18 GrayU8 (boofcv.struct.image.GrayU8)8 Test (org.junit.Test)7 BackgroundModelMoving (boofcv.alg.background.BackgroundModelMoving)4 ImageType (boofcv.struct.image.ImageType)4 Random (java.util.Random)3 Affine2D_F32 (georegression.struct.affine.Affine2D_F32)2 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)2 Point2D_F32 (georegression.struct.point.Point2D_F32)2 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)1 PointTracker (boofcv.abst.feature.tracker.PointTracker)1 GenericBackgroundStationaryBasicChecks (boofcv.alg.background.stationary.GenericBackgroundStationaryBasicChecks)1 GenericBackgroundStationaryGaussianChecks (boofcv.alg.background.stationary.GenericBackgroundStationaryGaussianChecks)1 GenericBackgroundStationaryGmmChecks (boofcv.alg.background.stationary.GenericBackgroundStationaryGmmChecks)1 PixelTransformAffine_F32 (boofcv.alg.distort.PixelTransformAffine_F32)1 PixelTransformHomography_F32 (boofcv.alg.distort.PixelTransformHomography_F32)1 PointTransformHomography_F32 (boofcv.alg.distort.PointTransformHomography_F32)1 ConfigBackgroundBasic (boofcv.factory.background.ConfigBackgroundBasic)1 ConfigBackgroundGaussian (boofcv.factory.background.ConfigBackgroundGaussian)1 ConfigBackgroundGmm (boofcv.factory.background.ConfigBackgroundGmm)1