Search in sources :

Example 1 with Kernel2D_F32

use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.

the class SteerableKernel_F32 method setBasis.

@Override
public void setBasis(SteerableCoefficients coef, Kernel2D... basis) {
    this.coef = coef;
    this.basis = basis;
    int width = basis[0].width;
    output = new Kernel2D_F32(width);
}
Also used : Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32)

Example 2 with Kernel2D_F32

use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method createDerivX.

private Kernel2D_F32 createDerivX(int r) {
    int size = r * 2 + 1;
    Kernel2D_F32 ret = new Kernel2D_F32(size);
    for (int y = 0; y < size; y++) {
        for (int x = 0; x < r; x++) {
            ret.set(x, y, -1);
            ret.set(x + r + 1, y, 1);
        }
    }
    return ret;
}
Also used : Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32)

Example 3 with Kernel2D_F32

use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelDerivXX.

@Test
public void kernelDerivXX() {
    GrayF32 orig = new GrayF32(width, height);
    GrayF32 integral = new GrayF32(width, height);
    ImageMiscOps.fillUniform(orig, rand, 0, 20);
    GrayF32 expected = new GrayF32(width, height);
    GrayF32 found = new GrayF32(width, height);
    IntegralImageOps.transform(orig, integral);
    ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorderAlgs.value(orig, 0);
    for (int i = 1; i <= 5; i += 2) {
        int size = i * 3;
        IntegralKernel kernelI = DerivativeIntegralImage.kernelDerivXX(size, null);
        Kernel2D_F32 kernel = createDerivXX(size);
        ConvolveImage.convolve(kernel, orig, expected, border);
        IntegralImageOps.convolve(integral, kernelI, found);
        BoofTesting.assertEquals(expected, found, 1e-2);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32) ImageBorder_F32(boofcv.core.image.border.ImageBorder_F32) Test(org.junit.Test)

Example 4 with Kernel2D_F32

use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method createDerivXY.

private Kernel2D_F32 createDerivXY(int size) {
    int block = size / 3;
    int border = (size - 2 * block - 1) / 2;
    int w = block * 3;
    Kernel2D_F32 ret = new Kernel2D_F32(w);
    for (int y = border; y < border + block; y++) {
        for (int x = border; x < block + border; x++) {
            ret.set(x, y, 1);
            ret.set(x + block + 1, y, -1);
        }
    }
    for (int y = border + block + 1; y < size - border; y++) {
        for (int x = border; x < block + border; x++) {
            ret.set(x, y, -1);
            ret.set(x + block + 1, y, 1);
        }
    }
    return ret;
}
Also used : Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32)

Example 5 with Kernel2D_F32

use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method derivYY.

@Test
public void derivYY() {
    GrayF32 orig = new GrayF32(width, height);
    GrayF32 integral = new GrayF32(width, height);
    ImageMiscOps.fillUniform(orig, rand, 0, 20);
    GrayF32 expected = new GrayF32(width, height);
    GrayF32 found = new GrayF32(width, height);
    IntegralImageOps.transform(orig, integral);
    for (int i = 1; i <= 5; i += 2) {
        int size = i * 3;
        Kernel2D_F32 kernel = createDerivXX(size);
        kernel = KernelMath.transpose(kernel);
        ConvolveImageNoBorder.convolve(kernel, orig, expected);
        DerivativeIntegralImage.derivYY(integral, found, size);
        int r = size / 2;
        GrayF32 a = expected.subimage(r + 1, r + 1, expected.width - r, expected.height - r, null);
        GrayF32 b = found.subimage(r + 1, r + 1, found.width - r, found.height - r, null);
        BoofTesting.assertEquals(a, b, 1e-2);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Kernel2D_F32(boofcv.struct.convolve.Kernel2D_F32) Test(org.junit.Test)

Aggregations

Kernel2D_F32 (boofcv.struct.convolve.Kernel2D_F32)25 Test (org.junit.Test)15 GrayF32 (boofcv.struct.image.GrayF32)13 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)7 ImageFunctionSparse (boofcv.abst.filter.ImageFunctionSparse)1 ImageConvolveSparse (boofcv.abst.filter.convolve.ImageConvolveSparse)1 BorderIndex1D_Extend (boofcv.core.image.border.BorderIndex1D_Extend)1 ImageBorder1D_F32 (boofcv.core.image.border.ImageBorder1D_F32)1 Kernel1D_F32 (boofcv.struct.convolve.Kernel1D_F32)1 Kernel2D (boofcv.struct.convolve.Kernel2D)1