use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryImageOps method labelToBinary_individual_indexes.
@Test
public void labelToBinary_individual_indexes() {
GrayU8 expected = new GrayU8(13, 8);
expected.data = TEST;
GrayU8 found = new GrayU8(13, 8);
GrayS32 input = new GrayS32(13, 8);
input.data = EXPECTED8;
BinaryImageOps.labelToBinary(input, found, 3, 2);
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 13; j++) {
if (input.get(j, i) == 2) {
assertEquals(1, found.get(j, i));
} else {
assertEquals(0, found.get(j, i));
}
}
}
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryImageOps method labelToBinary.
@Test
public void labelToBinary() {
GrayU8 expected = new GrayU8(13, 8);
expected.data = TEST;
GrayU8 found = new GrayU8(13, 8);
GrayS32 input = new GrayS32(13, 8);
input.data = EXPECTED8;
BinaryImageOps.labelToBinary(input, found);
BoofTesting.assertEquals(expected, found, 0);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryImageOps method contour.
/**
* Very crude and not exhaustive check of contour
*/
@Test
public void contour() {
GrayU8 input = new GrayU8(10, 12);
ImageMiscOps.fillRectangle(input, 1, 2, 3, 4, 5);
input.set(9, 11, 1);
GrayS32 output = new GrayS32(10, 12);
GrayS32 expected = new GrayS32(10, 12);
ImageMiscOps.fillRectangle(expected, 1, 2, 3, 4, 5);
expected.set(9, 11, 2);
List<Contour> found = BinaryImageOps.contour(input, ConnectRule.FOUR, output);
assertEquals(2, found.size());
BoofTesting.assertEquals(expected, output, 0);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestBinaryImageOps method logicXor.
@Test
public void logicXor() {
GrayU8 image0 = new GrayU8(5, 6);
GrayU8 image1 = new GrayU8(5, 6);
image0.set(0, 0, 1);
image0.set(1, 1, 1);
image1.set(0, 0, 0);
image1.set(1, 1, 1);
GrayU8 out = BinaryImageOps.logicXor(image0, image1, null);
assertEquals(1, out.get(0, 0));
assertEquals(0, out.get(1, 1));
assertEquals(0, out.get(0, 1));
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestContourTracer method two_horizontal.
@Test
public void two_horizontal() {
GrayU8 pattern = new GrayU8(2, 1);
ImageMiscOps.fill(pattern, 1);
shiftContourCheck(pattern, 2, ConnectRule.FOUR);
shiftContourCheck(pattern, 2, ConnectRule.EIGHT);
}
Aggregations