use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class DisplayPinholeCalibrationPanel method setCalibration.
@Override
public void setCalibration(CameraPinholeRadial param) {
CameraPinhole undistorted = new CameraPinhole(param);
this.undoRadial = LensDistortionOps.changeCameraModel(AdjustmentType.FULL_VIEW, BorderType.ZERO, param, undistorted, null, ImageType.single(GrayF32.class));
this.remove_p_to_p = LensDistortionOps.transformChangeModel_F32(AdjustmentType.FULL_VIEW, param, undistorted, false, null);
undoRadialDistortion(distorted);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestLensDistortionOps method transformChangeModel_F32_EXPAND_modified.
/**
* Sees if the adjusted intrinsic parameters is correct but computing normalized image coordinates first
* with the original distorted image and then with the adjusted undistorted image.
*/
@Test
public void transformChangeModel_F32_EXPAND_modified() {
// distorted pixel in original image
float pixelX = 12.5f, pixelY = height - 3;
CameraPinholeRadial orig = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(0.1, 0.05);
CameraPinhole desired = new CameraPinhole(orig);
Point2Transform2_F32 distToNorm = LensDistortionOps.narrow(orig).undistort_F32(true, false);
Point2D_F32 norm = new Point2D_F32();
distToNorm.compute(pixelX, pixelY, norm);
CameraPinholeRadial adjusted = new CameraPinholeRadial();
Point2Transform2_F32 distToAdj = LensDistortionOps.transformChangeModel_F32(AdjustmentType.EXPAND, orig, desired, false, adjusted);
Point2D_F32 adjPixel = new Point2D_F32();
Point2D_F32 normFound = new Point2D_F32();
distToAdj.compute(pixelX, pixelY, adjPixel);
PerspectiveOps.convertPixelToNorm(adjusted, adjPixel, normFound);
// see if the normalized image coordinates are the same
assertEquals(norm.x, normFound.x, 1e-3);
assertEquals(norm.y, normFound.y, 1e-3);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestLensDistortionOps method transformChangeModel_F32_EXPAND.
/**
* Checks the border of the returned transform. Makes sure that no none-visible portion is visible.
* Also makes sure that the requested inverse transform is actually the inverse.
*/
@Test
public void transformChangeModel_F32_EXPAND() {
CameraPinholeRadial param = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(0.1, 1e-4);
CameraPinhole desired = new CameraPinhole(param);
Point2Transform2_F32 adjToDist = LensDistortionOps.transformChangeModel_F32(AdjustmentType.EXPAND, param, desired, true, null);
Point2Transform2_F32 distToAdj = LensDistortionOps.transformChangeModel_F32(AdjustmentType.EXPAND, param, desired, false, null);
checkInside(adjToDist, distToAdj);
// distort it in the other direction
param = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(-0.1, -1e-4);
adjToDist = LensDistortionOps.transformChangeModel_F32(AdjustmentType.EXPAND, param, desired, true, null);
distToAdj = LensDistortionOps.transformChangeModel_F32(AdjustmentType.EXPAND, param, desired, false, null);
checkInside(adjToDist, distToAdj);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestLensDistortionOps method transformChangeModel_F32_FULLVIEW.
/**
* Checks the border of the returned transform. Makes sure that the entire original image is visible.
* Also makes sure that the requested inverse transform is actually the inverse.
*/
@Test
public void transformChangeModel_F32_FULLVIEW() {
CameraPinholeRadial param = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(0.1, 0.05);
CameraPinhole desired = new CameraPinhole(param);
Point2Transform2_F32 adjToDist = LensDistortionOps.transformChangeModel_F32(AdjustmentType.FULL_VIEW, param, desired, true, null);
Point2Transform2_F32 distToAdj = LensDistortionOps.transformChangeModel_F32(AdjustmentType.FULL_VIEW, param, desired, false, null);
checkBorderOutside(adjToDist, distToAdj);
param = new CameraPinholeRadial().fsetK(300, 320, 0, 150, 130, width, height).fsetRadial(-0.1, -0.05);
desired = new CameraPinhole(param);
adjToDist = LensDistortionOps.transformChangeModel_F32(AdjustmentType.FULL_VIEW, param, desired, true, null);
distToAdj = LensDistortionOps.transformChangeModel_F32(AdjustmentType.FULL_VIEW, param, desired, false, null);
checkBorderOutside(adjToDist, distToAdj);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestNarrowToWidePtoP_F32 method createModelNarrow.
public static LensDistortionNarrowFOV createModelNarrow() {
CameraPinhole model = new CameraPinhole();
model.fsetK(400, 400, 0, 250, 250, 500, 500);
return new LensDistortionPinhole(model);
}
Aggregations