public void configure(LensDistortionNarrowFOV narrow, LensDistortionWideFOV wide) { narrowToNorm = narrow.undistort_F32(true,false); unitToWide = wide.distortStoP_F32(); }
public void configure(LensDistortionNarrowFOV narrow, LensDistortionWideFOV wide) { narrowToNorm = narrow.undistort_F32(true,false); unitToWide = wide.distortStoP_F32(); }
public static Point2Transform2_F32 transformPixelToRect(CameraPinholeRadial param, FMatrixRMaj rectify) { Point2Transform2_F32 remove_p_to_p = narrow(param).undistort_F32(true, true); PointTransformHomography_F32 rectifyDistort = new PointTransformHomography_F32(rectify); return new SequencePoint2Transform2_F32(remove_p_to_p,rectifyDistort); }
/** * <p> * Creates a transform that applies rectification to unrectified distorted pixels. * </p> * * @param param Intrinsic parameters. Not modified. * @param rectify Transform for rectifying the image. Not modified. * @return Transform from unrectified to rectified pixels */ public static Point2Transform2_F32 transformPixelToRect_F32(CameraPinholeRadial param, DenseMatrix64F rectify) { Point2Transform2_F32 remove_p_to_p = transformPoint(param).undistort_F32(true, true); PointTransformHomography_F32 rectifyPixel = new PointTransformHomography_F32(rectify); return new SequencePoint2Transform2_F32(remove_p_to_p,rectifyPixel); }
boolean undistortedToDistorted) Point2Transform2_F32 remove_p_to_p = transformPoint(param).undistort_F32(true, true);
public static Point2Transform2_F32 transformPixelToRectNorm(CameraPinholeRadial param, FMatrixRMaj rectify, FMatrixRMaj rectifyK) { if (rectifyK.get(0, 1) != 0) throw new IllegalArgumentException("Skew should be zero in rectified images"); Point2Transform2_F32 remove_p_to_p = narrow(param).undistort_F32(true, true); PointTransformHomography_F32 rectifyDistort = new PointTransformHomography_F32(rectify); PinholePtoN_F32 pixelToNorm = new PinholePtoN_F32(); pixelToNorm.set(rectifyK.get(0, 0), rectifyK.get(1, 1), rectifyK.get(0, 1), rectifyK.get(0, 2), rectifyK.get(1, 2)); return new SequencePoint2Transform2_F32(remove_p_to_p, rectifyDistort, pixelToNorm); }
LensDistortionNarrowFOV desired = LensDistortionFactory.narrow(paramDesired); Point2Transform2_F32 ori_p_to_n = original.undistort_F32(true, false); Point2Transform2_F32 des_n_to_p = desired.distort_F32(false, true); Point2Transform2_F32 des_p_to_n = desired.undistort_F32(true, false); Point2Transform2_F32 ori_n_to_p = original.distort_F32(false, true); PointTransformHomography_F32 adjust = new PointTransformHomography_F32(A);
/** * Specifies the image's intrinsic parameters and target size * * @param distortion Lens distortion * @param width Image width * @param height Image height * @param cache If there's lens distortion should it cache the transforms? Speeds it up by about 12%. Ignored * if no lens distortion */ public void configure(LensDistortionNarrowFOV distortion, int width , int height , boolean cache ) { Point2Transform2_F32 pointSquareToInput; Point2Transform2_F32 pointDistToUndist = distortion.undistort_F32(true,true); Point2Transform2_F32 pointUndistToDist = distortion.distort_F32(true,true); PixelTransform2_F32 distToUndist = new PointToPixelTransform_F32(pointDistToUndist); PixelTransform2_F32 undistToDist = new PointToPixelTransform_F32(pointUndistToDist); if( cache ) { distToUndist = new PixelTransformCached_F32(width, height, distToUndist); undistToDist = new PixelTransformCached_F32(width, height, undistToDist); } squareDetector.setLensDistortion(width, height,distToUndist,undistToDist); pointSquareToInput = new SequencePoint2Transform2_F32(transformHomography,pointUndistToDist); // provide intrinsic camera parameters PixelTransform2_F32 squareToInput= new PointToPixelTransform_F32(pointSquareToInput); removePerspective.setModel(squareToInput); this.undistToDist = distortion.distort_F64(true,true); }