use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestZhang99ComputeTargetHomography method basicTest.
public void basicTest(boolean removeAFew) {
// create a grid an apply an arbitrary transform to it
List<Point2D_F64> layout = GenericCalibrationGrid.standardLayout();
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.02, -0.05, 0.01, null);
Vector3D_F64 T = new Vector3D_F64(0, 0, -1000);
Se3_F64 motion = new Se3_F64(R, T);
CalibrationObservation observations = GenericCalibrationGrid.observations(motion, layout);
if (removeAFew) {
for (int i = 0; i < 6; i++) {
observations.points.remove(5);
}
}
// compute the homography
Zhang99ComputeTargetHomography alg = new Zhang99ComputeTargetHomography(layout);
assertTrue(alg.computeHomography(observations));
DMatrixRMaj H = alg.getHomography();
// test this homography property: x2 = H*x1
for (int i = 0; i < observations.size(); i++) {
int gridIndex = observations.get(i).index;
Point2D_F64 p = observations.get(i);
Point2D_F64 a = GeometryMath_F64.mult(H, layout.get(gridIndex), new Point2D_F64());
double diff = a.distance(p);
assertEquals(0, diff, 1e-8);
}
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestTrifocalAlgebraicPoint7 method checkInducedErrors.
/**
* Computes the error using induced homographies.
*/
public void checkInducedErrors(TrifocalTensor tensor, List<AssociatedTriple> observations, double tol) {
for (AssociatedTriple o : observations) {
// homogeneous vector for observations in views 2 and 3
Vector3D_F64 obs2 = new Vector3D_F64(o.p2.x, o.p2.y, 1);
Vector3D_F64 obs3 = new Vector3D_F64(o.p3.x, o.p3.y, 1);
// compute lines which pass through the observations
Vector3D_F64 axisY = new Vector3D_F64(0, 1, 0);
Vector3D_F64 line2 = new Vector3D_F64();
Vector3D_F64 line3 = new Vector3D_F64();
GeometryMath_F64.cross(obs2, axisY, line2);
GeometryMath_F64.cross(obs3, axisY, line3);
// compute induced homographies
DMatrixRMaj H12 = MultiViewOps.inducedHomography12(tensor, line3, null);
DMatrixRMaj H13 = MultiViewOps.inducedHomography13(tensor, line2, null);
Point2D_F64 induced2 = new Point2D_F64();
Point2D_F64 induced3 = new Point2D_F64();
GeometryMath_F64.mult(H12, o.p1, induced2);
GeometryMath_F64.mult(H13, o.p1, induced3);
assertEquals(0, induced2.distance(o.p2), tol);
assertEquals(0, induced3.distance(o.p3), tol);
}
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestDetectCircleRegularGrid method checkCounterClockWise.
static void checkCounterClockWise(Grid g) {
EllipseRotated_F64 a = g.get(0, 0);
EllipseRotated_F64 b = g.get(0, 1);
EllipseRotated_F64 c = g.get(1, 0);
double dx0 = b.center.x - a.center.x;
double dy0 = b.center.y - a.center.y;
double dx1 = c.center.x - a.center.x;
double dy1 = c.center.y - a.center.y;
Vector3D_F64 v = new Vector3D_F64();
GeometryMath_F64.cross(dx0, dy0, 0, dx1, dy1, 0, v);
assertTrue(v.z > 0);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class VisualOdometryPanel method setCameraToWorld.
public void setCameraToWorld(Se3_F64 cameraToWorld) {
displayX.setText(String.format("%6.1f", cameraToWorld.getT().x));
displayY.setText(String.format("%6.1f", cameraToWorld.getT().y));
displayZ.setText(String.format("%6.1f", cameraToWorld.getT().z));
Vector3D_F64 v = new Vector3D_F64(0, 0, 1);
GeometryMath_F64.mult(cameraToWorld.getR(), v, v);
orientation.setVector(v);
orientation.repaint();
displayOrigin.setText(String.format("%6.1f", cameraToWorld.getT().norm()));
if (prevToWorld == null) {
prevToWorld = cameraToWorld.copy();
} else {
Se3_F64 worldToPrev = prevToWorld.invert(null);
cameraToWorld.concat(worldToPrev, prevToWorld);
integral += prevToWorld.getT().norm();
prevToWorld.set(cameraToWorld);
}
displayIntegral.setText(String.format("%6.1f", integral));
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class VisualOdometryPanel2 method setCameraToWorld.
public void setCameraToWorld(Se3_F64 cameraToWorld) {
Vector3D_F64 v = new Vector3D_F64(0, 0, 1);
GeometryMath_F64.mult(cameraToWorld.getR(), v, v);
orientation.setVector(v);
orientation.repaint();
displayOrigin.setText(String.format("%6.1f", cameraToWorld.getT().norm()));
if (prevToWorld == null) {
prevToWorld = cameraToWorld.copy();
} else {
Se3_F64 worldToPrev = prevToWorld.invert(null);
cameraToWorld.concat(worldToPrev, prevToWorld);
integral += prevToWorld.getT().norm();
prevToWorld.set(cameraToWorld);
}
displayIntegral.setText(String.format("%6.1f", integral));
}
Aggregations