use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryNaiveOps method edge8_border.
@Test
public void edge8_border() {
GrayU8 input;
input = createInput(1, 1, 1, 1, 1, 1, 1, 1, 1);
checkImage("edge8", input, 0, 0, 0, 0, 0, 0, 0, 0, 0);
input = createInput(0, 0, 0, 0, 1, 0, 0, 0, 0);
checkImage("edge8", input, 0, 0, 0, 0, 1, 0, 0, 0, 0);
input = createInput(0, 1, 0, 1, 1, 1, 0, 1, 0);
checkImage("edge8", input, 0, 1, 0, 1, 1, 1, 0, 1, 0);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryNaiveOps method erode4_border.
@Test
public void erode4_border() {
GrayU8 input;
input = createInput(0, 1, 0, 1, 1, 1, 0, 1, 0);
checkImage("erode4", input, 0, 0, 0, 0, 1, 0, 0, 0, 0);
input = createInput(1, 1, 1, 1, 1, 1, 1, 1, 1);
checkImage("erode4", input, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryThinning method thinning.
/**
* Run the overall algorithm and compare against a known result
*/
@Test
public void thinning() {
GrayU8 img = new GrayU8(20, 25);
ImageMiscOps.fill(img.subimage(1, 5, 19, 10), 1);
BinaryThinning alg = new BinaryThinning();
alg.apply(img, -1);
// the tests below aren't really that great. really just checks to see if the algorithm has changed
assertEquals(24, ImageStatistics.sum(img));
for (int i = 2; i < 18; i++) {
assertEquals(1, img.get(i, 7));
}
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryThinning method findBlackPixels.
@Test
public void findBlackPixels() {
GrayU8 img = new GrayU8(5, 7);
img.set(2, 3, 1);
img.set(4, 1, 1);
findBlackPixels(img);
findBlackPixels(BoofTesting.createSubImageOf(img));
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryThinning method checkGenericMask.
@Test
public void checkGenericMask() {
// manually construct masks which will fit the first of each type of mask
GrayU8 imgA = new GrayU8(3, 3);
imgA.data = new byte[] { 0, 0, 0, 0, 1, 0, 1, 1, 1 };
GrayU8 imgB = new GrayU8(3, 3);
imgB.data = new byte[] { 0, 0, 0, 1, 1, 0, 1, 1, 0 };
BinaryThinning alg = new BinaryThinning();
// these are then rotated through all the perputations
checkGenericMask(imgA, imgB, alg);
checkGenericMask(BoofTesting.createSubImageOf(imgA), BoofTesting.createSubImageOf(imgB), alg);
}
Aggregations