Search in sources :

Example 1 with ImageBorder

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);
        }
    }
}
Also used : SparseImageGradient(boofcv.struct.sparse.SparseImageGradient) GradientValue(boofcv.struct.sparse.GradientValue) ImageBorder(boofcv.core.image.border.ImageBorder) FactoryImageBorder(boofcv.core.image.border.FactoryImageBorder) ImageGradient(boofcv.abst.filter.derivative.ImageGradient) SparseImageGradient(boofcv.struct.sparse.SparseImageGradient) Test(org.junit.Test)

Example 2 with ImageBorder

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());
}
Also used : FactoryImageBorder(boofcv.core.image.border.FactoryImageBorder) ImageBorder(boofcv.core.image.border.ImageBorder) Test(org.junit.Test)

Example 3 with ImageBorder

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 };
}
Also used : ImageGray(boofcv.struct.image.ImageGray) ImageBorderValue(boofcv.core.image.border.ImageBorderValue) ImageBorder(boofcv.core.image.border.ImageBorder)

Aggregations

ImageBorder (boofcv.core.image.border.ImageBorder)3 FactoryImageBorder (boofcv.core.image.border.FactoryImageBorder)2 Test (org.junit.Test)2 ImageGradient (boofcv.abst.filter.derivative.ImageGradient)1 ImageBorderValue (boofcv.core.image.border.ImageBorderValue)1 ImageGray (boofcv.struct.image.ImageGray)1 GradientValue (boofcv.struct.sparse.GradientValue)1 SparseImageGradient (boofcv.struct.sparse.SparseImageGradient)1