use of boofcv.core.image.border.ImageBorder in project BoofCV by lessthanoptimal.
the class GeneralGradientSparse method compareToFullImage_Border.
@Test
public void compareToFullImage_Border() {
ImageBorder border = FactoryImageBorder.single(imageType, BorderType.EXTENDED);
ImageGradient gradient = createGradient();
gradient.setBorderType(BorderType.EXTENDED);
gradient.process(image, derivX, derivY);
SparseImageGradient alg = createAlg(border);
alg.setImage(image);
for (int i = 0; i < image.height; i++) {
for (int j = 0; j < image.width; j++) {
assertTrue(j + " " + i, image.isInBounds(j, i));
GradientValue g = alg.compute(j, i);
double expectedX = GeneralizedImageOps.get(derivX, j, i);
double expectedY = GeneralizedImageOps.get(derivY, j, i);
assertEquals(expectedX, g.getX(), 1e-4f);
assertEquals(expectedY, g.getY(), 1e-4f);
}
}
}
use of boofcv.core.image.border.ImageBorder in project BoofCV by lessthanoptimal.
the class TestInterpolatePixel_S_to_MB method checkFunctions.
@Test
public void checkFunctions() {
Helper helper = new Helper();
InterpolatePixelMB alg = new InterpolatePixel_S_to_MB(helper);
float[] pixel = new float[1];
assertEquals(1, alg.getImageType().getNumBands());
alg.get(2, 3, pixel);
assertEquals(2, pixel[0], 1e-8);
alg.get_fast(2, 3, pixel);
assertEquals(3, pixel[0], 1e-8);
assertTrue(alg.isInFastBounds(20, 4));
assertFalse(alg.isInFastBounds(0, 4));
assertEquals(10, alg.getFastBorderX());
assertEquals(11, alg.getFastBorderY());
ImageBorder border = FactoryImageBorder.genericValue(0, alg.getImageType());
alg.setBorder(border);
assertTrue(border == alg.getBorder());
}
use of boofcv.core.image.border.ImageBorder in project BoofCV by lessthanoptimal.
the class TestConvolveImageBox method reformatForValidation.
@Override
protected Object[] reformatForValidation(Method m, Object[] targetParam) {
Class<?>[] params = m.getParameterTypes();
Object kernel = TestConvolveImageBox.createTableKernel(params[0], kernelRadius, rand);
ImageGray output = (ImageGray) ((ImageGray) targetParam[1]).clone();
ImageBorder border = output.getDataType().isInteger() ? new ImageBorderValue.Value_I(0) : new ImageBorderValue.Value_F32(0);
return new Object[] { kernel, targetParam[0], output, border };
}
Aggregations