@Override public void setLensDistortion(LensDistortionNarrowFOV distortion) { if( distortion != null ) { this.hasCameraModel = true; this.lensDistortion = distortion; this.pixelToNorm = lensDistortion.undistort_F64(true, false); } else { this.hasCameraModel = false; this.lensDistortion = null; this.pixelToNorm = null; } }
/** * Specifies the intrinsic parameters. * @param distortion Intrinsic camera parameters */ public void setLensDistoriton(LensDistortionNarrowFOV distortion ) { pixelToNorm = distortion.undistort_F64(true,false); normToPixel = distortion.distort_F64(false, true); }
public void configure(LensDistortionNarrowFOV narrow, LensDistortionWideFOV wide) { narrowToNorm = narrow.undistort_F64(true,false); unitToWide = wide.distortStoP_F64(); }
public void configure(LensDistortionNarrowFOV narrow, LensDistortionWideFOV wide) { narrowToNorm = narrow.undistort_F64(true,false); unitToWide = wide.distortStoP_F64(); }
public static Point2Transform2_F64 transformPixelToRect(CameraPinholeRadial param, DMatrixRMaj rectify) { Point2Transform2_F64 remove_p_to_p = narrow(param).undistort_F64(true, true); PointTransformHomography_F64 rectifyDistort = new PointTransformHomography_F64(rectify); return new SequencePoint2Transform2_F64(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 distorted pixel to rectified pixels */ public static Point2Transform2_F64 transformPixelToRect_F64(CameraPinholeRadial param, DenseMatrix64F rectify) { Point2Transform2_F64 remove_p_to_p = transformPoint(param).undistort_F64(true, true); PointTransformHomography_F64 rectifyDistort = new PointTransformHomography_F64(rectify); return new SequencePoint2Transform2_F64(remove_p_to_p,rectifyDistort); }
@Override public void setLensDistortion(LensDistortionNarrowFOV distortion) { super.setLensDistortion(distortion); if( distortion == null ) { distToUndist = new DoNothing2Transform2_F64(); undistToDist = new DoNothing2Transform2_F64(); } else { poseEstimator.setLensDistoriton(distortion); distToUndist = distortion.undistort_F64(true, true); undistToDist = distortion.distort_F64(true, true); } }
/** * Convert a set of associated point features from pixel coordinates into normalized image coordinates. */ public List<AssociatedPair> convertToNormalizedCoordinates() { Point2Transform2_F64 tran = LensDistortionOps.narrow(intrinsic).undistort_F64(true,false); List<AssociatedPair> calibratedFeatures = new ArrayList<>(); FastQueue<AssociatedIndex> matches = associate.getMatches(); for( AssociatedIndex a : matches.toList() ) { Point2D_F64 p1 = locationSrc.get( a.src ); Point2D_F64 p2 = locationDst.get( a.dst ); AssociatedPair c = new AssociatedPair(); tran.compute(p1.x, p1.y, c.p1); tran.compute(p2.x, p2.y, c.p2); calibratedFeatures.add(c); } return calibratedFeatures; }
boolean undistortedToDistorted) Point2Transform2_F64 remove_p_to_p = transformPoint(param).undistort_F64(true, true);
public static Point2Transform2_F64 transformPixelToRectNorm(CameraPinholeRadial param, DMatrixRMaj rectify, DMatrixRMaj rectifyK) { if (rectifyK.get(0, 1) != 0) throw new IllegalArgumentException("Skew should be zero in rectified images"); Point2Transform2_F64 remove_p_to_p = narrow(param).undistort_F64(true, true); PointTransformHomography_F64 rectifyDistort = new PointTransformHomography_F64(rectify); PinholePtoN_F64 pixelToNorm = new PinholePtoN_F64(); 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_F64(remove_p_to_p, rectifyDistort, pixelToNorm); }
LensDistortionNarrowFOV desired = LensDistortionFactory.narrow(paramDesired); Point2Transform2_F64 ori_p_to_n = original.undistort_F64(true, false); Point2Transform2_F64 des_n_to_p = desired.distort_F64(false, true); Point2Transform2_F64 des_p_to_n = desired.undistort_F64(true, false); Point2Transform2_F64 ori_n_to_p = original.distort_F64(false, true); PointTransformHomography_F64 adjust = new PointTransformHomography_F64(A);
/** * <p> * Creates a transform that applies rectification to unrectified distorted pixels and outputs * normalized pixel coordinates. * </p> * * @param param Intrinsic parameters. * @param rectify Transform for rectifying the image. * @param rectifyK Camera calibration matrix after rectification * @return Transform from unrectified to rectified normalized pixels */ public static Point2Transform2_F64 transformPixelToRectNorm_F64(CameraPinholeRadial param, DenseMatrix64F rectify, DenseMatrix64F rectifyK) { if (rectifyK.get(0, 1) != 0) throw new IllegalArgumentException("Skew should be zero in rectified images"); Point2Transform2_F64 remove_p_to_p = transformPoint(param).undistort_F64(true, true); PointTransformHomography_F64 rectifyDistort = new PointTransformHomography_F64(rectify); PinholePtoN_F64 pixelToNorm = new PinholePtoN_F64(); 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_F64(remove_p_to_p, rectifyDistort, pixelToNorm); }