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