use of boofcv.struct.sfm.ScaleTranslate2D in project BoofCV by lessthanoptimal.
the class TestModelManagerScaleTranslate2D method copyModel.
@Test
public void copyModel() {
ModelManagerScaleTranslate2D alg = new ModelManagerScaleTranslate2D();
ScaleTranslate2D model = new ScaleTranslate2D(1, 2, 3);
ScaleTranslate2D found = new ScaleTranslate2D();
alg.copyModel(model, found);
assertEquals(model.scale, found.scale, 1e-8);
assertEquals(model.transX, found.transX, 1e-8);
assertEquals(model.transY, found.transY, 1e-8);
}
use of boofcv.struct.sfm.ScaleTranslate2D in project BoofCV by lessthanoptimal.
the class TestTldAdjustRegion method adjustRectangle.
@Test
public void adjustRectangle() {
TldAdjustRegion alg = new TldAdjustRegion(50);
Rectangle2D_F64 rect = new Rectangle2D_F64(10, 20, 30, 40);
ScaleTranslate2D motion = new ScaleTranslate2D(1.5, 2, 3);
alg.adjustRectangle(rect, motion);
assertEquals(17, rect.p0.x, 1e-8);
assertEquals(33, rect.p0.y, 1e-8);
assertEquals(47, rect.p1.x, 1e-8);
assertEquals(63, rect.p1.y, 1e-8);
}
use of boofcv.struct.sfm.ScaleTranslate2D in project BoofCV by lessthanoptimal.
the class TestDistanceScaleTranslate2DSq method perfect.
@Test
public void perfect() {
ScaleTranslate2D model = new ScaleTranslate2D(1.5, -2, 3);
AssociatedPair a = apply(-5, 4, model);
DistanceScaleTranslate2DSq alg = new DistanceScaleTranslate2DSq();
alg.setModel(model);
assertEquals(0, alg.computeDistance(a), 1e-8);
}
use of boofcv.struct.sfm.ScaleTranslate2D in project BoofCV by lessthanoptimal.
the class TestDistanceScaleTranslate2DSq method noisy.
@Test
public void noisy() {
ScaleTranslate2D model = new ScaleTranslate2D(1.5, -2, 3);
AssociatedPair a = apply(-5, 4, model);
a.p2.x += 3.5;
DistanceScaleTranslate2DSq alg = new DistanceScaleTranslate2DSq();
alg.setModel(model);
assertEquals(3.5 * 3.5, alg.computeDistance(a), 1e-8);
}
use of boofcv.struct.sfm.ScaleTranslate2D in project BoofCV by lessthanoptimal.
the class TestGenerateScaleTranslate2D method onePointAtZero_a.
/**
* Possible pathological case. One point is at zero.
*/
@Test
public void onePointAtZero_a() {
ScaleTranslate2D model = new ScaleTranslate2D(1.5, -2, 3);
AssociatedPair a = TestDistanceScaleTranslate2DSq.apply(0, 0, model);
AssociatedPair b = TestDistanceScaleTranslate2DSq.apply(2, 3, model);
List<AssociatedPair> obs = new ArrayList<>();
obs.add(a);
obs.add(b);
ScaleTranslate2D found = new ScaleTranslate2D();
GenerateScaleTranslate2D alg = new GenerateScaleTranslate2D();
assertTrue(alg.generate(obs, found));
assertEquals(model.transX, found.transX, 1e-8);
assertEquals(model.transY, found.transY, 1e-8);
assertEquals(model.scale, found.scale, 1e-8);
}
Aggregations