Search in sources :

Example 16 with Point2Transform2_F64

use of boofcv.struct.distort.Point2Transform2_F64 in project BoofCV by lessthanoptimal.

the class VideoSequenceSimulator method createSquares.

protected void createSquares(int total, double minZ, double maxZ) {
    squares.clear();
    double t = 0.1;
    Point2D_F64 n = new Point2D_F64();
    Point2Transform2_F64 tranNorm = LensDistortionOps.narrow(intrinsic).undistort_F64(true, false);
    for (int i = 0; i < total; i++) {
        // generate the squares uniformally inside the FOV
        tranNorm.compute(rand.nextDouble() * (intrinsic.width - 1), rand.nextDouble() * (intrinsic.height - 1), n);
        double z = rand.nextDouble() * (maxZ - minZ) + minZ;
        double x = n.x * z;
        double y = n.y * z;
        Square s = new Square();
        s.a.set(x, y, z);
        s.b.set(x + t, y, z);
        s.c.set(x + t, y + t, z);
        s.d.set(x, y + t, z);
        s.gray = rand.nextInt(200) + 55;
        squares.add(s);
    }
    // sort by depth so that objects farther way are rendered first and obstructed by objects closer in view
    Collections.sort(squares, new Comparator<Square>() {

        @Override
        public int compare(Square o1, Square o2) {
            if (o1.a.z < o2.a.z)
                return -1;
            if (o1.a.z > o2.a.z)
                return 1;
            else
                return 0;
        }
    });
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64)

Example 17 with Point2Transform2_F64

use of boofcv.struct.distort.Point2Transform2_F64 in project BoofCV by lessthanoptimal.

the class ImplRectifyImageOps_F64 method transformPixelToRectNorm.

public static Point2Transform2_F64 transformPixelToRectNorm(CameraPinholeRadial param, DMatrixRMaj rectify, DMatrixRMaj rectifyK) {
    if (rectifyK.get(0, 1) != 0)
        throw new IllegalArgumentException("Skew should be zero in rectified images");
    Point2Transform2_F64 remove_p_to_p = narrow(param).undistort_F64(true, true);
    PointTransformHomography_F64 rectifyDistort = new PointTransformHomography_F64(rectify);
    PinholePtoN_F64 pixelToNorm = new PinholePtoN_F64();
    pixelToNorm.set(rectifyK.get(0, 0), rectifyK.get(1, 1), rectifyK.get(0, 1), rectifyK.get(0, 2), rectifyK.get(1, 2));
    return new SequencePoint2Transform2_F64(remove_p_to_p, rectifyDistort, pixelToNorm);
}
Also used : PinholePtoN_F64(boofcv.alg.distort.pinhole.PinholePtoN_F64) PointTransformHomography_F64(boofcv.alg.distort.PointTransformHomography_F64) SequencePoint2Transform2_F64(boofcv.struct.distort.SequencePoint2Transform2_F64) Point2Transform2_F64(boofcv.struct.distort.Point2Transform2_F64) SequencePoint2Transform2_F64(boofcv.struct.distort.SequencePoint2Transform2_F64)

Example 18 with Point2Transform2_F64

use of boofcv.struct.distort.Point2Transform2_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 19 with Point2Transform2_F64

use of boofcv.struct.distort.Point2Transform2_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 20 with Point2Transform2_F64

use of boofcv.struct.distort.Point2Transform2_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

Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)28 Point2D_F64 (georegression.struct.point.Point2D_F64)15 Point3D_F64 (georegression.struct.point.Point3D_F64)7 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)6 SequencePoint2Transform2_F64 (boofcv.struct.distort.SequencePoint2Transform2_F64)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 PointTransformHomography_F64 (boofcv.alg.distort.PointTransformHomography_F64)4 AssociatedPair (boofcv.struct.geo.AssociatedPair)4 Se3_F64 (georegression.struct.se.Se3_F64)4 DMatrixRMaj (org.ejml.data.DMatrixRMaj)4 PointToPixelTransform_F64 (boofcv.alg.distort.PointToPixelTransform_F64)3 LensDistortionRadialTangential (boofcv.alg.distort.radtan.LensDistortionRadialTangential)3 RectangleLength2D_F64 (georegression.struct.shapes.RectangleLength2D_F64)3 Point2D3D (boofcv.struct.geo.Point2D3D)2 GrayU8 (boofcv.struct.image.GrayU8)2 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)1 LensDistortionNarrowFOV (boofcv.alg.distort.LensDistortionNarrowFOV)1 PointToPixelTransform_F32 (boofcv.alg.distort.PointToPixelTransform_F32)1 PinholePtoN_F64 (boofcv.alg.distort.pinhole.PinholePtoN_F64)1