Search in sources :

Example 6 with SequencePoint2Transform2_F32

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

the class PyramidDirectColorDepth_to_DepthVisualOdometry method setCalibration.

@Override
public void setCalibration(CameraPinholeBrown 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_F32.transformChangeModel(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
    PixelTransform<Point2D_F32> pixelAdjToDepth = new PixelTransformCached_F32(paramAdjusted.width, paramAdjusted.height, adjustedToDepth);
    // adjusted pixels to normalized image coordinates in RGB frame
    sparse3D.configure(LensDistortionFactory.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 : Point2D_F32(georegression.struct.point.Point2D_F32) 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)

Aggregations

Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)6 SequencePoint2Transform2_F32 (boofcv.struct.distort.SequencePoint2Transform2_F32)6 PointTransformHomography_F32 (boofcv.alg.distort.PointTransformHomography_F32)3 CameraPinhole (boofcv.struct.calib.CameraPinhole)2 FMatrixRMaj (org.ejml.data.FMatrixRMaj)2 PixelTransformCached_F32 (boofcv.alg.distort.PixelTransformCached_F32)1 PinholePtoN_F32 (boofcv.alg.distort.pinhole.PinholePtoN_F32)1 PixelTransform2_F32 (boofcv.struct.distort.PixelTransform2_F32)1 Point2D_F32 (georegression.struct.point.Point2D_F32)1 RectangleLength2D_F32 (georegression.struct.shapes.RectangleLength2D_F32)1