Search in sources :

Example 1 with RectangleLength2D_F64

use of georegression.struct.shapes.RectangleLength2D_F64 in project BoofCV by lessthanoptimal.

the class TestLensDistortionOps method boundBoxInside_F64.

@Test
public void boundBoxInside_F64() {
    // basic sanity check
    Affine2D_F64 affine = new Affine2D_F64(1, 1, 0, 1, 1, 2);
    PixelTransformAffine_F64 transform = new PixelTransformAffine_F64(affine);
    RectangleLength2D_F64 found = LensDistortionOps.boundBoxInside(20, 10, transform);
    assertEquals(10, found.x0, 1e-8);
    assertEquals(2, found.y0, 1e-8);
    assertEquals(20 - 9, found.width, 1e-8);
    assertEquals(10, found.height, 1e-8);
}
Also used : Affine2D_F64(georegression.struct.affine.Affine2D_F64) RectangleLength2D_F64(georegression.struct.shapes.RectangleLength2D_F64) Test(org.junit.Test)

Example 2 with RectangleLength2D_F64

use of georegression.struct.shapes.RectangleLength2D_F64 in project BoofCV by lessthanoptimal.

the class ImplRectifyImageOps_F64 method fullViewLeft.

public static void fullViewLeft(CameraPinholeRadial paramLeft, DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight, DMatrixRMaj rectifyK) {
    // need to take in account the order in which image distort will remove rectification later on
    paramLeft = new CameraPinholeRadial(paramLeft);
    Point2Transform2_F64 tranLeft = transformPixelToRect(paramLeft, rectifyLeft);
    RectangleLength2D_F64 bound = DistortImageOps.boundBox_F64(paramLeft.width, paramLeft.height, new PointToPixelTransform_F64(tranLeft));
    double scaleX = paramLeft.width / bound.width;
    double scaleY = paramLeft.height / bound.height;
    double scale = Math.min(scaleX, scaleY);
    adjustCalibrated(rectifyLeft, rectifyRight, rectifyK, bound, scale);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) SequencePoint2Transform2_F64(boofcv.struct.distort.SequencePoint2Transform2_F64) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64) PointToPixelTransform_F64(boofcv.alg.distort.PointToPixelTransform_F64) RectangleLength2D_F64(georegression.struct.shapes.RectangleLength2D_F64)

Example 3 with RectangleLength2D_F64

use of georegression.struct.shapes.RectangleLength2D_F64 in project BoofCV by lessthanoptimal.

the class ImplRectifyImageOps_F64 method allInsideLeft.

public static void allInsideLeft(int imageWidth, int imageHeight, DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight) {
    PointTransformHomography_F64 tranLeft = new PointTransformHomography_F64(rectifyLeft);
    RectangleLength2D_F64 bound = LensDistortionOps.boundBoxInside(imageWidth, imageHeight, new PointToPixelTransform_F64(tranLeft));
    double scaleX = imageWidth / (double) bound.width;
    double scaleY = imageHeight / (double) bound.height;
    double scale = Math.max(scaleX, scaleY);
    adjustUncalibrated(rectifyLeft, rectifyRight, bound, scale);
}
Also used : PointTransformHomography_F64(boofcv.alg.distort.PointTransformHomography_F64) PointToPixelTransform_F64(boofcv.alg.distort.PointToPixelTransform_F64) RectangleLength2D_F64(georegression.struct.shapes.RectangleLength2D_F64)

Example 4 with RectangleLength2D_F64

use of georegression.struct.shapes.RectangleLength2D_F64 in project BoofCV by lessthanoptimal.

the class ImplRectifyImageOps_F64 method allInsideLeft.

public static void allInsideLeft(CameraPinholeRadial paramLeft, DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight, DMatrixRMaj rectifyK) {
    // need to take in account the order in which image distort will remove rectification later on
    paramLeft = new CameraPinholeRadial(paramLeft);
    Point2Transform2_F64 tranLeft = transformPixelToRect(paramLeft, rectifyLeft);
    RectangleLength2D_F64 bound = LensDistortionOps.boundBoxInside(paramLeft.width, paramLeft.height, new PointToPixelTransform_F64(tranLeft));
    LensDistortionOps.roundInside(bound);
    double scaleX = paramLeft.width / (double) bound.width;
    double scaleY = paramLeft.height / (double) bound.height;
    double scale = Math.max(scaleX, scaleY);
    adjustCalibrated(rectifyLeft, rectifyRight, rectifyK, bound, scale);
}
Also used : CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) SequencePoint2Transform2_F64(boofcv.struct.distort.SequencePoint2Transform2_F64) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64) PointToPixelTransform_F64(boofcv.alg.distort.PointToPixelTransform_F64) RectangleLength2D_F64(georegression.struct.shapes.RectangleLength2D_F64)

Example 5 with RectangleLength2D_F64

use of georegression.struct.shapes.RectangleLength2D_F64 in project BoofCV by lessthanoptimal.

the class ImplRectifyImageOps_F64 method fullViewLeft.

public static void fullViewLeft(int imageWidth, int imageHeight, DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight) {
    Point2Transform2_F64 tranLeft = new PointTransformHomography_F64(rectifyLeft);
    RectangleLength2D_F64 bound = DistortImageOps.boundBox_F64(imageWidth, imageHeight, new PointToPixelTransform_F64(tranLeft));
    double scaleX = imageWidth / bound.width;
    double scaleY = imageHeight / bound.height;
    double scale = Math.min(scaleX, scaleY);
    adjustUncalibrated(rectifyLeft, rectifyRight, bound, scale);
}
Also used : PointTransformHomography_F64(boofcv.alg.distort.PointTransformHomography_F64) SequencePoint2Transform2_F64(boofcv.struct.distort.SequencePoint2Transform2_F64) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64) PointToPixelTransform_F64(boofcv.alg.distort.PointToPixelTransform_F64) RectangleLength2D_F64(georegression.struct.shapes.RectangleLength2D_F64)

Aggregations

RectangleLength2D_F64 (georegression.struct.shapes.RectangleLength2D_F64)7 PointToPixelTransform_F64 (boofcv.alg.distort.PointToPixelTransform_F64)4 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)3 SequencePoint2Transform2_F64 (boofcv.struct.distort.SequencePoint2Transform2_F64)3 PointTransformHomography_F64 (boofcv.alg.distort.PointTransformHomography_F64)2 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)2 Affine2D_F64 (georegression.struct.affine.Affine2D_F64)2 Test (org.junit.Test)2 ImageRectangle_F64 (boofcv.struct.ImageRectangle_F64)1