use of boofcv.struct.image.GrayS32 in project BoofCV by lessthanoptimal.
the class WaveletTransformInt method transform.
@Override
public GrayS32 transform(T original, GrayS32 transformed) {
if (transformed == null) {
ImageDimension d = UtilWavelet.transformDimension(original, numLevels);
transformed = new GrayS32(d.width, d.height);
}
temp.reshape(transformed.width, transformed.height);
copyInput.reshape(original.width, original.height);
if (original.getDataType().getDataType() == int.class) {
copyInput.setTo((GrayS32) original);
} else {
GConvertImage.convert(original, copyInput);
}
WaveletTransformOps.transformN(desc, copyInput, transformed, temp, numLevels);
return transformed;
}
use of boofcv.struct.image.GrayS32 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.GrayS32 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.GrayS32 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.GrayS32 in project BoofCV by lessthanoptimal.
the class TestBinaryImageOps method relabel.
@Test
public void relabel() {
GrayS32 input = new GrayS32(4, 5);
input.set(0, 0, 1);
input.set(1, 1, 2);
input.set(2, 1, 3);
int[] convert = { 0, 2, 3, 4 };
BinaryImageOps.relabel(input, convert);
assertEquals(0, input.get(0, 1));
assertEquals(2, input.get(0, 0));
assertEquals(3, input.get(1, 1));
assertEquals(4, input.get(2, 1));
}
Aggregations