use of georegression.struct.point.Point4D_F64 in project BoofCV by lessthanoptimal.
the class GeoTestingOps method randomPointsH_F64.
public static List<Point4D_F64> randomPointsH_F64(double minX, double maxX, double minY, double maxY, double minZ, double maxZ, int num, Random rand) {
List<Point4D_F64> ret = new ArrayList<>();
for (int i = 0; i < num; i++) {
double x = rand.nextDouble() * (maxX - minX) + minX;
double y = rand.nextDouble() * (maxY - minY) + minY;
double z = rand.nextDouble() * (maxZ - minZ) + minZ;
double w = rand.nextDouble() * 0.01 + 1.0;
ret.add(new Point4D_F64(x, y, z, w));
}
return ret;
}
use of georegression.struct.point.Point4D_F64 in project BoofCV by lessthanoptimal.
the class GeneralCheckTriangulateRefineMetricH method incorrectInput.
@Test
void incorrectInput() {
createScene();
Point4D_F64 initial = convertH(worldPoint);
initial.x += 0.01;
initial.y += 0.1;
initial.z += -0.05;
initial.w *= 1.1;
Point4D_F64 found = new Point4D_F64();
triangulate(obsNorm, motionWorldToCamera, essential, initial, found);
double error2 = worldPoint.distance(convertH(initial));
double error = worldPoint.distance(convertH(found));
assertTrue(error < error2 * 0.5);
}
use of georegression.struct.point.Point4D_F64 in project BoofCV by lessthanoptimal.
the class GeneralCheckTriangulateRefineMetricH method perfectInput.
@Test
void perfectInput() {
createScene();
Point4D_F64 initial = convertH(worldPoint);
Point4D_F64 found = new Point4D_F64();
triangulate(obsNorm, motionWorldToCamera, essential, initial, found);
assertEquals(0.0, worldPoint.distance(convertH(found)), UtilEjml.TEST_F64_SQ);
}
use of georegression.struct.point.Point4D_F64 in project BoofCV by lessthanoptimal.
the class GenericBundleAdjustmentMetricChecks method checkReprojectionError.
public static void checkReprojectionError(SceneStructureMetric structure, SceneObservations observations, double tol) {
BundlePinhole c = (BundlePinhole) structure.cameras.get(0).model;
// making a bunch of assumptions here...
CameraPinhole intrinsic = new CameraPinhole(c.fx, c.fy, c.skew, c.cx, c.cy, 600, 600);
WorldToCameraToPixel wcp = new WorldToCameraToPixel();
PointIndex2D_F64 o = new PointIndex2D_F64();
Point2D_F64 predicted = new Point2D_F64();
if (structure.homogenous) {
Point4D_F64 p4 = new Point4D_F64();
Point3D_F64 p3 = new Point3D_F64();
for (int viewIndex = 0; viewIndex < observations.views.size; viewIndex++) {
SceneObservations.View v = observations.views.data[viewIndex];
Se3_F64 parent_to_view = structure.getParentToView(viewIndex);
wcp.configure(intrinsic, parent_to_view);
for (int j = 0; j < v.point.size; j++) {
v.getPixel(j, o);
structure.points.data[o.index].get(p4);
p3.x = p4.x / p4.w;
p3.y = p4.y / p4.w;
p3.z = p4.z / p4.w;
wcp.transform(p3, predicted);
double residual = o.p.distance(predicted);
if (Math.abs(residual) > tol)
fail("Error is too large. " + residual);
}
}
} else {
Point3D_F64 p3 = new Point3D_F64();
for (int viewIndex = 0; viewIndex < observations.views.size; viewIndex++) {
SceneObservations.View v = observations.views.data[viewIndex];
Se3_F64 parent_to_view = structure.getParentToView(viewIndex);
wcp.configure(intrinsic, parent_to_view);
for (int j = 0; j < v.point.size; j++) {
v.getPixel(j, o);
structure.points.data[o.index].get(p3);
wcp.transform(p3, predicted);
double residual = o.p.distance(predicted);
if (Math.abs(residual) > tol)
fail("Error is too large. " + residual);
}
}
}
}
use of georegression.struct.point.Point4D_F64 in project BoofCV by lessthanoptimal.
the class GeneralCheckTriangulateRefineProjective method incorrectInput.
@Test
void incorrectInput() {
createScene();
Point4D_F64 initial = convertH(worldPoint);
initial.x += 0.01;
initial.y += 0.1;
initial.z += -0.05;
initial.w *= 1.1;
Point4D_F64 found = new Point4D_F64();
triangulate(obsPixels, cameraMatrices, initial, found);
double error2 = worldPoint.distance(convertH(initial));
double error = worldPoint.distance(convertH(found));
assertTrue(error < error2 * 0.5);
}
Aggregations