use of boofcv.struct.geo.AssociatedTuple in project BoofCV by lessthanoptimal.
the class CommonProjectiveToMetricCamerasChecks method add.
void add(double x1, double y1, double x2, double y2, double x3, double y3, DogArray<AssociatedTuple> observations) {
AssociatedTuple a = observations.grow();
a.set(0, x1, y1);
a.set(1, x2, y2);
a.set(2, x3, y3);
}
use of boofcv.struct.geo.AssociatedTuple in project BoofCV by lessthanoptimal.
the class CommonProjectiveToMetricCamerasChecks method real_world_case0.
/**
* In this situation a scene was created where points appeared behind the camera. Taken from real data
*/
@Test
void real_world_case0() {
DMatrixRMaj P2 = new DMatrixRMaj(3, 4, true, 71.2714309, -1.50598476, -354.50553, -.052935998, -1.28683386, 39.1891727, 672.658283, -.994592935, .00056663, -.019338274, 70.0397946, -.000445996);
DMatrixRMaj P3 = new DMatrixRMaj(3, 4, true, 32.4647875, -1.02054892, -241.805355, -.054715714, -1.8370892, -.061992654, .486096194, -1.00684043, .000185405, -.010046842, 31.8668685, -.000209807);
DogArray<AssociatedTuple> observations = new DogArray<>(() -> new AssociatedTupleN(3));
// These are in front of both cameras
add(-47.208221435546875, -14.024078369140625, -49.9302978515625, 36.35797119140625, -50.079071044921875, 77.59286499023438, observations);
add(-203.9057159423828, 70.39932250976562, -207.64544677734375, 124.38552856445312, -206.31866455078125, 172.38186645507812, observations);
add(-362.7781524658203, -218.54442596435547, -361.6542053222656, -160.6702880859375, -363.30285263061523, -107.35969543457031, observations);
add(-154.99310302734375, 3.35784912109375, -158.14512634277344, 55.362579345703125, -157.7862548828125, 100.77597045898438, observations);
add(-170.89407348632812, -181.27266693115234, -172.10398864746094, -127.54672241210938, -174.48524475097656, -81.65957641601562, observations);
add(41.3905029296875, 170.15188598632812, 39.365081787109375, 221.3468017578125, 43.634307861328125, 261.2353515625, observations);
add(-350.1354789733887, -229.5992660522461, -349.162899017334, -171.76145935058594, -351.1237335205078, -118.83564758300781, observations);
add(-50.12109375, -14.451873779296875, -52.87139892578125, 35.835052490234375, -53.014801025390625, 77.25506591796875, observations);
add(-250.23069763183594, -212.5504379272461, -250.5589599609375, -156.41912841796875, -252.87100219726562, -107.27978515625, observations);
// These are behind at least one camera
add(154.89532470703125, -21.821807861328125, 151.21435546875, 41.2327880859375, 151.974365234375, 93.64697265625, observations);
add(226.85003662109375, -95.77021789550781, 221.5345458984375, -35.9564208984375, 219.90155029296875, 12.154052734375, observations);
add(237.870361328125, -46.12437438964844, 232.88519287109375, 13.570709228515625, 232.98577880859375, 61.028564453125, observations);
add(162.7314453125, -165.1600341796875, 156.9556884765625, -99.56578063964844, 154.2447509765625, -45.94012451171875, observations);
add(283.9959716796875, -147.1155242919922, 276.13848876953125, -86.35987854003906, 273.4132080078125, -40.23883056640625, observations);
add(135.57574462890625, -232.8561019897461, 129.67437744140625, -163.39407348632812, 125.60736083984375, -107.20663452148438, observations);
add(-21.8720703125, -162.5299530029297, -24.70025634765625, -101.63801574707031, -27.263427734375, -50.05320739746094, observations);
add(62.40008544921875, -173.78022003173828, 59.92376708984375, -105.06491088867188, 56.91351318359375, -45.15827941894531, observations);
add(-63.860626220703125, -259.0756492614746, -65.89141845703125, -195.2255096435547, -69.55535888671875, -142.1841278076172, observations);
List<ElevateViewInfo> views = new ArrayList<>();
for (int i = 0; i < 3; i++) {
views.add(new ElevateViewInfo(800, 600, i));
}
List<DMatrixRMaj> inputCameras = new ArrayList<>();
inputCameras.add(P2);
inputCameras.add(P3);
var results = new MetricCameras();
ProjectiveToMetricCameras alg = createEstimator(false);
assertTrue(alg.process(views, inputCameras, observations.toList(), results));
// Yes internally most implementations run this function, but the number of invalid was > 0 before
var checkMatches = new ResolveSignAmbiguityPositiveDepth();
checkMatches.process(observations.toList(), results);
assertFalse(checkMatches.signChanged);
assertEquals(0, checkMatches.bestInvalid);
}
Aggregations