use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestDescribeImageDenseSift method checkSampleLocations.
/**
* Checks to see if the returned location is actually where it sampled
*/
@Test
public void checkSampleLocations() {
for (Class type : imageTypes) {
ImageGray image = GeneralizedImageOps.createSingleBand(type, width, height);
GImageMiscOps.fillUniform(image, rand, 0, 200);
DescribeImageDense alg = createAlg(type, 8, 9);
alg.process(image);
List<Point2D_I32> locations = alg.getLocations();
for (int i = 0; i < locations.size(); i++) {
Point2D_I32 p = locations.get(i);
TupleDesc_F64 expected = describe(p.x, p.y, image, alg);
TupleDesc_F64 found = (TupleDesc_F64) alg.getDescriptions().get(i);
for (int j = 0; j < expected.size(); j++) {
assertEquals(expected.value[j], found.value[j], 1e-8);
}
}
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class Contour method copy.
public Contour copy() {
Contour ret = new Contour();
for (Point2D_I32 p : external) {
ret.external.add(p.copy());
}
for (List<Point2D_I32> l : ret.internal) {
List<Point2D_I32> a = new ArrayList<>();
for (Point2D_I32 p : l) {
a.add(p.copy());
}
internal.add(a);
}
return ret;
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestBinaryImageOps method labelToClusters.
@Test
public void labelToClusters() {
FastQueue<Point2D_I32> queue = new FastQueue<>(16, Point2D_I32.class, true);
GrayS32 labels = new GrayS32(4, 4);
labels.data = new int[] { 1, 2, 3, 4, 5, 0, 2, 2, 3, 4, 4, 4, 0, 0, 0, 0 };
List<List<Point2D_I32>> ret = BinaryImageOps.labelToClusters(labels, 5, queue);
assertEquals(5, ret.size());
assertEquals(1, ret.get(0).size());
assertEquals(3, ret.get(1).size());
assertEquals(2, ret.get(2).size());
assertEquals(4, ret.get(3).size());
assertEquals(1, ret.get(4).size());
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestLinearContourLabelChang2004 method print.
private void print(List<Point2D_I32> l, int w, int h) {
GrayU8 img = new GrayU8(w, h);
for (Point2D_I32 p : l) {
img.set(p.x, p.y, 1);
}
img.print();
System.out.println("------------------");
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestLinearContourLabelChang2004 method findContour4.
/**
* Create an unordered list of all points in the internal and external contour
*/
private List<Point2D_I32> findContour4(GrayS32 labeled, int target) {
List<Point2D_I32> list = new ArrayList<>();
ImageBorder<GrayS32> border = FactoryImageBorder.singleValue(labeled, 0);
for (int y = 0; y < labeled.height; y++) {
for (int x = 0; x < labeled.width; x++) {
if (target == labeled.get(x, y)) {
boolean isContour = false;
for (int i = 0; i < local.size(); i++) {
Point2D_I32 a = local.get(i);
if (get(border, x + a.x, y + a.y) != target) {
isContour = true;
}
}
if (isContour)
list.add(new Point2D_I32(x, y));
}
}
}
return list;
}
Aggregations