use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class DisparityPointCloudViewer method createWorldToCamera.
public Se3_F64 createWorldToCamera() {
// pick an appropriate amount of motion for the scene
double z = baseline * focalLengthX / (minDisparity + rangeDisparity);
double adjust = baseline / 20.0;
Vector3D_F64 rotPt = new Vector3D_F64(offsetX * adjust, offsetY * adjust, z * range);
double radians = tiltAngle * Math.PI / 180.0;
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, radians, 0, 0, null);
Se3_F64 a = new Se3_F64(R, rotPt);
return a;
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class PointCloudViewer method keyPressed.
@Override
public void keyPressed(KeyEvent e) {
Vector3D_F64 T = worldToCamera.getT();
if (e.getKeyChar() == 'w') {
T.z -= stepSize;
} else if (e.getKeyChar() == 's') {
T.z += stepSize;
} else if (e.getKeyChar() == 'a') {
T.x += stepSize;
} else if (e.getKeyChar() == 'd') {
T.x -= stepSize;
} else if (e.getKeyChar() == 'q') {
T.y -= stepSize;
} else if (e.getKeyChar() == 'e') {
T.y += stepSize;
} else if (e.getKeyChar() == 'h') {
worldToCamera.reset();
}
repaint();
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestDecomposeEssential method multipleCalls.
/**
* Checks to see if the same solution is returned when invoked multiple times
*/
@Test
public void multipleCalls() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, -0.4, 0.5, null);
Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
DMatrixRMaj E = MultiViewOps.createEssential(R, T);
DecomposeEssential alg = new DecomposeEssential();
// call it twice and see if it breaks
alg.decompose(E);
alg.decompose(E);
List<Se3_F64> solutions = alg.getSolutions();
assertEquals(4, solutions.size());
checkUnique(solutions);
checkHasOriginal(solutions, R, T);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestDecomposeEssential method checkAgainstKnown.
/**
* Check the decomposition against a known input. See if the solutions have the expected
* properties and at least one matches the input.
*/
@Test
public void checkAgainstKnown() {
DMatrixRMaj R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, -0.4, 0.5, null);
Vector3D_F64 T = new Vector3D_F64(2, 1, -3);
DMatrixRMaj E = MultiViewOps.createEssential(R, T);
DecomposeEssential alg = new DecomposeEssential();
alg.decompose(E);
List<Se3_F64> solutions = alg.getSolutions();
assertEquals(4, solutions.size());
checkUnique(solutions);
checkHasOriginal(solutions, R, T);
}
use of georegression.struct.point.Vector3D_F64 in project BoofCV by lessthanoptimal.
the class TestDecomposeHomography method checkHasOriginal.
/*
* See if an equivalent to the input matrix exists
*/
public static void checkHasOriginal(List<Se3_F64> solutionsSE, List<Vector3D_F64> solutionsN, DMatrixRMaj R, Vector3D_F64 T, double d, Vector3D_F64 N) {
int numMatches = 0;
for (int i = 0; i < 4; i++) {
Se3_F64 foundSE = solutionsSE.get(i);
Vector3D_F64 foundN = solutionsN.get(i);
if (!MatrixFeatures_DDRM.isIdentical(foundSE.getR(), R, 1e-4))
break;
if (Math.abs(T.x / d - foundSE.getT().x) > 1e-8)
break;
if (Math.abs(T.y / d - foundSE.getT().y) > 1e-8)
break;
if (Math.abs(T.z / d - foundSE.getT().z) > 1e-8)
break;
if (Math.abs(N.x - foundN.x) > 1e-8)
break;
if (Math.abs(N.y - foundN.y) > 1e-8)
break;
if (Math.abs(N.z - foundN.z) > 1e-8)
break;
numMatches++;
}
assertEquals(1, numMatches);
}
Aggregations