use of boofcv.struct.calib.CameraUniversalOmni in project BoofCV by lessthanoptimal.
the class TestNarrowToWidePtoP_F64 method createModelWide.
public static LensDistortionWideFOV createModelWide() {
CameraUniversalOmni model = new CameraUniversalOmni(2);
model.fsetK(1.349e3, 1.343e3, 0, 480, 480, 960, 1080);
model.fsetMirror(3.61);
model.fsetRadial(7.308e-1, 1.855e1);
model.fsetTangental(-1.288e-2, -1.1342e-2);
return new LensDistortionUniversalOmni(model);
}
use of boofcv.struct.calib.CameraUniversalOmni in project BoofCV by lessthanoptimal.
the class TestUniOmniPtoS_F32 method back_and_forth.
private void back_and_forth(float mirror) {
CameraUniversalOmni model = createModel(mirror);
UniOmniPtoS_F32 pixelToUnit = new UniOmniPtoS_F32();
pixelToUnit.setModel(model);
UniOmniStoP_F32 unitToPixel = new UniOmniStoP_F32();
unitToPixel.setModel(model);
List<Point2D_F32> listPixels = new ArrayList<>();
listPixels.add(new Point2D_F32(320, 240));
listPixels.add(new Point2D_F32(320, 200));
listPixels.add(new Point2D_F32(320, 280));
listPixels.add(new Point2D_F32(280, 240));
listPixels.add(new Point2D_F32(360, 240));
listPixels.add(new Point2D_F32(280, 240));
listPixels.add(new Point2D_F32(240, 180));
for (Point2D_F32 pixel : listPixels) {
Point3D_F32 circle = new Point3D_F32(10, 10, 10);
// directly forward on unit sphere
pixelToUnit.compute(pixel.x, pixel.y, circle);
// it should be on the unit circle
assertEquals(1.0f, circle.norm(), GrlConstants.TEST_F32);
Point2D_F32 found = new Point2D_F32();
unitToPixel.compute(circle.x, circle.y, circle.z, found);
assertEquals(pixel.x, found.x, GrlConstants.TEST_SQ_F32);
assertEquals(pixel.y, found.y, GrlConstants.TEST_SQ_F32);
}
}
use of boofcv.struct.calib.CameraUniversalOmni in project BoofCV by lessthanoptimal.
the class TestUniOmniPtoS_F32 method centerIsCenter.
private void centerIsCenter(float mirror) {
CameraUniversalOmni model = createModel(mirror);
UniOmniPtoS_F32 alg = new UniOmniPtoS_F32();
alg.setModel(model);
Point3D_F32 found = new Point3D_F32(10, 10, 10);
// directly forward on unit sphere
alg.compute(320, 240, found);
assertEquals(0, found.x, GrlConstants.TEST_F32);
assertEquals(0, found.y, GrlConstants.TEST_F32);
assertEquals(1, found.z, GrlConstants.TEST_F32);
}
use of boofcv.struct.calib.CameraUniversalOmni in project BoofCV by lessthanoptimal.
the class TestUniOmniPtoS_F32 method createModel.
public static CameraUniversalOmni createModel(float mirror) {
CameraUniversalOmni model = new CameraUniversalOmni(2);
model.fsetK(400, 405, 0.01f, 320, 240, 640, 480);
model.fsetMirror(mirror);
model.fsetRadial(0.01f, -0.03f);
model.fsetTangental(0.001f, 0.002f);
return model;
}
use of boofcv.struct.calib.CameraUniversalOmni in project BoofCV by lessthanoptimal.
the class TestUniOmniPtoS_F64 method back_and_forth.
private void back_and_forth(double mirror) {
CameraUniversalOmni model = createModel(mirror);
UniOmniPtoS_F64 pixelToUnit = new UniOmniPtoS_F64();
pixelToUnit.setModel(model);
UniOmniStoP_F64 unitToPixel = new UniOmniStoP_F64();
unitToPixel.setModel(model);
List<Point2D_F64> listPixels = new ArrayList<>();
listPixels.add(new Point2D_F64(320, 240));
listPixels.add(new Point2D_F64(320, 200));
listPixels.add(new Point2D_F64(320, 280));
listPixels.add(new Point2D_F64(280, 240));
listPixels.add(new Point2D_F64(360, 240));
listPixels.add(new Point2D_F64(280, 240));
listPixels.add(new Point2D_F64(240, 180));
for (Point2D_F64 pixel : listPixels) {
Point3D_F64 circle = new Point3D_F64(10, 10, 10);
// directly forward on unit sphere
pixelToUnit.compute(pixel.x, pixel.y, circle);
// it should be on the unit circle
assertEquals(1.0, circle.norm(), GrlConstants.TEST_F64);
Point2D_F64 found = new Point2D_F64();
unitToPixel.compute(circle.x, circle.y, circle.z, found);
assertEquals(pixel.x, found.x, GrlConstants.TEST_SQ_F64);
assertEquals(pixel.y, found.y, GrlConstants.TEST_SQ_F64);
}
}
Aggregations