Search in sources :

Example 16 with PixelTransform2_F32

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

the class PyramidDirectColorDepth_to_DepthVisualOdometry method setCalibration.

@Override
public void setCalibration(CameraPinholeRadial paramVisual, Point2Transform2_F32 visToDepth) {
    // the algorithms camera model assumes no lens distortion and that skew = 0
    CameraPinhole desired = new CameraPinhole(paramVisual);
    desired.skew = 0;
    adjustImage = LensDistortionOps.changeCameraModel(AdjustmentType.EXPAND, BorderType.ZERO, paramVisual, desired, paramAdjusted, algType);
    Point2Transform2_F32 desiredToOriginal = LensDistortionOps.transformChangeModel_F32(AdjustmentType.EXPAND, paramVisual, desired, false, null);
    // the adjusted undistorted image pixel to the depth image transform
    Point2Transform2_F32 adjustedToDepth = new SequencePoint2Transform2_F32(desiredToOriginal, visToDepth);
    // Create a lookup table to make the math much faster
    PixelTransform2_F32 pixelAdjToDepth = new PixelTransformCached_F32(paramAdjusted.width, paramAdjusted.height, adjustedToDepth);
    // adjusted pixels to normalized image coordinates in RGB frame
    sparse3D.configure(LensDistortionOps.narrow(paramAdjusted), pixelAdjToDepth);
    undistorted.reshape(paramAdjusted.width, paramAdjusted.height);
    if (convertInput != null) {
        inputConverted.reshape(paramAdjusted.width, paramAdjusted.height);
    }
    alg.setCameraParameters((float) paramAdjusted.fx, (float) paramAdjusted.fy, (float) paramAdjusted.cx, (float) paramAdjusted.cy, paramAdjusted.width, paramAdjusted.height);
}
Also used : SequencePoint2Transform2_F32(boofcv.struct.distort.SequencePoint2Transform2_F32) Point2Transform2_F32(boofcv.struct.distort.Point2Transform2_F32) SequencePoint2Transform2_F32(boofcv.struct.distort.SequencePoint2Transform2_F32) CameraPinhole(boofcv.struct.calib.CameraPinhole) PixelTransform2_F32(boofcv.struct.distort.PixelTransform2_F32) PixelTransformCached_F32(boofcv.alg.distort.PixelTransformCached_F32)

Example 17 with PixelTransform2_F32

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

PixelTransform2_F32 (boofcv.struct.distort.PixelTransform2_F32)17 Test (org.junit.Test)7 PixelTransformAffine_F32 (boofcv.alg.distort.PixelTransformAffine_F32)6 Affine2D_F32 (georegression.struct.affine.Affine2D_F32)6 GrayU8 (boofcv.struct.image.GrayU8)4 ImageDistort (boofcv.alg.distort.ImageDistort)2 PixelTransformCached_F32 (boofcv.alg.distort.PixelTransformCached_F32)2 InterpolatePixel (boofcv.alg.interpolate.InterpolatePixel)2 GrayF32 (boofcv.struct.image.GrayF32)2 Affine2D_F64 (georegression.struct.affine.Affine2D_F64)2 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)2 ArrayList (java.util.ArrayList)2 Estimate1ofEpipolar (boofcv.abst.geo.Estimate1ofEpipolar)1 PixelTransformHomography_F32 (boofcv.alg.distort.PixelTransformHomography_F32)1 PointToPixelTransform_F32 (boofcv.alg.distort.PointToPixelTransform_F32)1 CameraPinhole (boofcv.struct.calib.CameraPinhole)1 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)1 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)1