Search in sources :

Example 26 with Point2Transform2_F32

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

Aggregations

Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)26 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)10 SequencePoint2Transform2_F32 (boofcv.struct.distort.SequencePoint2Transform2_F32)9 Point2D_F32 (georegression.struct.point.Point2D_F32)9 Test (org.junit.Test)9 CameraPinhole (boofcv.struct.calib.CameraPinhole)7 PointToPixelTransform_F32 (boofcv.alg.distort.PointToPixelTransform_F32)5 FMatrixRMaj (org.ejml.data.FMatrixRMaj)5 PointTransformHomography_F32 (boofcv.alg.distort.PointTransformHomography_F32)4 RectangleLength2D_F32 (georegression.struct.shapes.RectangleLength2D_F32)4 LensDistortionRadialTangential (boofcv.alg.distort.radtan.LensDistortionRadialTangential)2 InterpolatePixelS (boofcv.alg.interpolate.InterpolatePixelS)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 PixelTransformCached_F32 (boofcv.alg.distort.PixelTransformCached_F32)1 PinholePtoN_F32 (boofcv.alg.distort.pinhole.PinholePtoN_F32)1 ImagePanel (boofcv.gui.image.ImagePanel)1 PixelTransform2_F32 (boofcv.struct.distort.PixelTransform2_F32)1 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)1 GrayU8 (boofcv.struct.image.GrayU8)1 Point3D_F32 (georegression.struct.point.Point3D_F32)1