use of org.ddogleg.struct.DogArray_F64 in project BoofCV by lessthanoptimal.
the class TestMultiViewStereoFromKnownSceneStructure method checkCloudPlane.
/**
* Checks to see if the point cloud is as expected. A 2D square planar object at a known distance and size. This
* takes in account noise
*/
private void checkCloudPlane(List<Point3D_F64> cloud) {
assertTrue(cloud.size() > 100);
DogArray_F64 arrayZ = new DogArray_F64();
arrayZ.resize(cloud.size());
arrayZ.reset();
double error = 0.0;
double x0 = Double.MAX_VALUE, x1 = -Double.MAX_VALUE;
double y0 = Double.MAX_VALUE, y1 = -Double.MAX_VALUE;
for (int i = 0; i < cloud.size(); i++) {
Point3D_F64 p = cloud.get(i);
double z = p.z;
if (// skip points at infinity
UtilEjml.isUncountable(z))
continue;
arrayZ.add(z);
error += Math.abs(z - planeZ);
// Only consider points which are very good fits
if (Math.abs(z - planeZ) > 0.01)
continue;
x0 = Math.min(x0, p.x);
x1 = Math.max(x1, p.x);
y0 = Math.min(y0, p.y);
y1 = Math.max(y1, p.y);
}
arrayZ.sort();
error /= cloud.size();
// Use the median depth to check distance
assertEquals(planeZ, arrayZ.getFraction(0.5), 0.005);
assertEquals(0.0, error, 0.04);
// The accuracy here is largely dependent on the image resolution, which sucks.
// 800x600 is within 0.04
assertEquals(-1.5, x0, 0.3);
assertEquals(1.5, x1, 0.3);
assertEquals(-1.5, y0, 0.3);
assertEquals(1.5, y1, 0.3);
}
Aggregations