use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestCannyEdge method checkNeighbor.
private void checkNeighbor(List<Point2D_I32> list) {
for (int i = 1; i < list.size(); i++) {
Point2D_I32 a = list.get(i - 1);
Point2D_I32 b = list.get(i);
int dx = Math.abs(a.x - b.x);
int dy = Math.abs(a.y - b.y);
assertTrue(dx <= 1 && dy <= 1);
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestDescribeDenseSiftAlg method computeDescriptor.
/**
* Compute to the general descriptor algorithm. They should produce the same results
*/
@Test
public void computeDescriptor() {
GrayF32 derivX = new GrayF32(100, 102);
GrayF32 derivY = new GrayF32(100, 102);
GImageMiscOps.fillUniform(derivX, rand, 0, 200);
GImageMiscOps.fillUniform(derivY, rand, 0, 200);
DescribeDenseSiftAlg<GrayF32> alg = new DescribeDenseSiftAlg<>(4, 4, 8, 0.5, 0.2, 10, 10, GrayF32.class);
DescribePointSift<GrayF32> algTest = new DescribePointSift<>(4, 4, 8, 1, 0.5, 0.2, GrayF32.class);
alg.setImageGradient(derivX, derivY);
algTest.setImageGradient(derivX, derivY);
List<Point2D_I32> samplePoints = new ArrayList<>();
samplePoints.add(new Point2D_I32(30, 35));
samplePoints.add(new Point2D_I32(45, 10));
samplePoints.add(new Point2D_I32(60, 12));
samplePoints.add(new Point2D_I32(50, 50));
TupleDesc_F64 found = new TupleDesc_F64(128);
TupleDesc_F64 expected = new TupleDesc_F64(128);
for (Point2D_I32 p : samplePoints) {
alg.computeDescriptor(p.x, p.y, found);
algTest.process(p.x, p.y, 1, 0, expected);
for (int i = 0; i < 128; i++) {
assertEquals(expected.value[i], found.value[i], 1e-8);
}
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestDescribePointSift method process.
/**
* Tests to see if it blows up and not much more. Random image. Compute descriptor along border and image
* center.
*/
@Test
public void process() {
GrayF32 derivX = new GrayF32(200, 200);
GrayF32 derivY = new GrayF32(200, 200);
GImageMiscOps.fillUniform(derivX, rand, -100, 100);
GImageMiscOps.fillUniform(derivY, rand, -100, 100);
DescribePointSift<GrayF32> alg = new DescribePointSift<>(4, 4, 8, 1.5, 0.5, 0.2, GrayF32.class);
alg.setImageGradient(derivX, derivY);
List<Point2D_I32> testPoints = new ArrayList<>();
testPoints.add(new Point2D_I32(100, 0));
testPoints.add(new Point2D_I32(100, 199));
testPoints.add(new Point2D_I32(0, 100));
testPoints.add(new Point2D_I32(199, 100));
testPoints.add(new Point2D_I32(100, 100));
TupleDesc_F64 desc = new TupleDesc_F64(alg.getDescriptorLength());
for (Point2D_I32 where : testPoints) {
alg.process(where.x, where.y, 2, 0.5, desc);
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class ChecksGenericPointsToPolyline method checkMinVertexes_sequence.
/**
* Checks to see if this feature can be changed and is enforced
*/
@Test
public void checkMinVertexes_sequence() {
PointsToPolyline alg = createAlg(false);
alg.setConvex(false);
alg.setMinimumSides(10);
List<Point2D_I32> contour = line(0, 0, 30, 0);
contour.addAll(line(30, 0, 30, 10));
contour.addAll(line(30, 10, 20, 10));
contour.addAll(line(20, 10, 20, 30));
contour.addAll(line(20, 30, 0, 30));
GrowQueue_I32 found = new GrowQueue_I32();
if (alg.process(contour, found)) {
assertEquals(9, found.size);
}
alg.setMinimumSides(3);
assertTrue(alg.process(contour, found));
check(found, 0, 30, 40, 50, 70, 89);
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class ChecksGenericPointsToPolyline method checkMinVertexes_loop.
/**
* Checks to see if this feature can be changed and is enforced
*/
@Test
public void checkMinVertexes_loop() {
PointsToPolyline alg = createAlg(true);
alg.setConvex(false);
alg.setMinimumSides(10);
List<Point2D_I32> contour = line(0, 0, 30, 0);
contour.addAll(line(30, 0, 30, 10));
contour.addAll(line(30, 10, 20, 10));
contour.addAll(line(20, 10, 20, 30));
contour.addAll(line(20, 30, 0, 30));
contour.addAll(line(0, 30, 0, 0));
GrowQueue_I32 found = new GrowQueue_I32();
if (alg.process(contour, found)) {
assertEquals(10, found.size);
}
alg.setMinimumSides(3);
assertTrue(alg.process(contour, found));
check(found, 0, 30, 40, 50, 70, 90);
}
Aggregations