use of imagingbook.pub.geometry.lines.AlgebraicLine in project imagingbook-common by imagingbook.
the class HoughLineTest method test0.
@Test
public void test0() {
// example from CV lecture notes
Pnt2d xRef = PntInt.from(90, 60);
AlgebraicLine h12 = AlgebraicLine.from(p1, p2);
HoughLine L12 = new HoughLine(h12, xRef.getX(), xRef.getY(), 0);
Assert.assertEquals(0.0, L12.getDistance(p1), 1E-6);
Assert.assertEquals(0.0, L12.getDistance(p2), 1E-6);
}
use of imagingbook.pub.geometry.lines.AlgebraicLine in project imagingbook-common by imagingbook.
the class HoughLineTest method test3.
@Test
public void test3() {
// lA, lH1 lH2 must be the same lines:
AlgebraicLine LA = AlgebraicLine.from(p1, p2);
HoughLine L1 = HoughLine.fromPoints(p1, p2, pRef, 2);
HoughLine L2 = new HoughLine(LA, pRef.getX(), pRef.getY(), 2);
Assert.assertEquals(0.0, LA.getDistance(p1), 1E-6);
Assert.assertEquals(0.0, LA.getDistance(p2), 1E-6);
Assert.assertEquals(0.0, L1.getDistance(p1), 1E-6);
Assert.assertEquals(0.0, L1.getDistance(p2), 1E-6);
Assert.assertEquals(0.0, L2.getDistance(p1), 1E-6);
Assert.assertEquals(0.0, L2.getDistance(p2), 1E-6);
}
use of imagingbook.pub.geometry.lines.AlgebraicLine in project imagingbook-common by imagingbook.
the class HoughLineTest method test5.
@Test
public void test5() {
// Example is used in CV lecture notes
// create L1 (zero-referenced):
double a1 = -90, b1 = 170, c1 = 1000;
AlgebraicLine L1 = new AlgebraicLine(a1, b1, c1);
// create L2 (with specific reference point):
double xR = 10, yR = 50;
double a2 = a1, b2 = b1, c2 = c1 + a1 * xR + b1 * yR;
HoughLine L2 = new HoughLine(a2, b2, c2, xR, yR, 0);
// make sure both are "equivalent" (contain the same points (x,y))
Assert.assertTrue(L1.equals(L2));
Assert.assertTrue(L2.equals(L1));
}
Aggregations