use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.
the class HomographyDirectLinearTransform method createA.
/**
* Compute the 'A' matrix used to solve for H from un-normalized points.
*/
protected void createA(List<AssociatedPair> points, DMatrixRMaj A) {
A.reshape(points.size() * 2, 9, false);
A.zero();
final int size = points.size();
for (int i = 0; i < size; i++) {
AssociatedPair p = points.get(i);
// the first image
Point2D_F64 f = p.p1;
// the second image
Point2D_F64 s = p.p2;
A.set(i * 2, 3, -f.x);
A.set(i * 2, 4, -f.y);
A.set(i * 2, 5, -1);
A.set(i * 2, 6, s.y * f.x);
A.set(i * 2, 7, s.y * f.y);
A.set(i * 2, 8, s.y);
A.set(i * 2 + 1, 0, f.x);
A.set(i * 2 + 1, 1, f.y);
A.set(i * 2 + 1, 2, 1);
A.set(i * 2 + 1, 6, -s.x * f.x);
A.set(i * 2 + 1, 7, -s.x * f.y);
A.set(i * 2 + 1, 8, -s.x);
}
}
use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.
the class TestImageMotionPtkSmartRespawn method createPair.
private AssociatedPair createPair(int x, int y) {
AssociatedPair p = new AssociatedPairTrack();
p.p1.set(x, y);
p.p2.set(x, y);
return p;
}
use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.
the class TestDistanceScaleTranslate2DSq method apply.
public static AssociatedPair apply(double x, double y, ScaleTranslate2D model) {
AssociatedPair p = new AssociatedPair();
p.p1.set(x, y);
p.p2.x = x * model.scale + model.transX;
p.p2.y = y * model.scale + model.transY;
return p;
}
use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.
the class TestDistanceScaleTranslate2DSq method multiple.
@Test
public void multiple() {
ScaleTranslate2D model = new ScaleTranslate2D(1.5, -2, 3);
AssociatedPair a = apply(-5, 4, model);
a.p2.x += 3.5;
AssociatedPair b = apply(2.15, 2, model);
List<AssociatedPair> obs = new ArrayList<>();
obs.add(a);
obs.add(b);
DistanceScaleTranslate2DSq alg = new DistanceScaleTranslate2DSq();
alg.setModel(model);
double[] found = new double[2];
alg.computeDistance(obs, found);
assertEquals(3.5 * 3.5, found[0], 1e-8);
assertEquals(0, found[1], 1e-8);
}
use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.
the class TestDistanceScaleTranslateRotate2DSq method noisy.
@Test
public void noisy() {
ScaleTranslateRotate2D model = new ScaleTranslateRotate2D(0.2, 1.5, -2, 3);
AssociatedPair a = apply(-5, 4, model);
a.p2.x += 3.5;
DistanceScaleTranslateRotate2DSq alg = new DistanceScaleTranslateRotate2DSq();
alg.setModel(model);
assertEquals(3.5 * 3.5, alg.computeDistance(a), 1e-8);
}
Aggregations