use of deepboof.tensors.Tensor_F32 in project BoofCV by lessthanoptimal.
the class TestDataManipulationOps method imageToTensor.
@Test
public void imageToTensor() {
Planar<GrayF32> image = new Planar<>(GrayF32.class, 30, 25, 2);
GImageMiscOps.fillUniform(image, rand, -2, 2);
Tensor_F32 tensor = new Tensor_F32(1, 2, 25, 30);
DataManipulationOps.imageToTensor(image, tensor, 0);
for (int band = 0; band < image.bands.length; band++) {
for (int i = 0; i < image.height; i++) {
for (int j = 0; j < image.width; j++) {
assertEquals(image.getBand(band).get(j, i), tensor.get(0, band, i, j), 1e-4f);
}
}
}
}
Aggregations