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);
}
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;
}
};
}
Aggregations