Search in sources :

Example 16 with ImageBorder_F32

use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelHaarX.

@Test
void kernelHaarX() {
    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 r = 1; r < 5; r++) {
        IntegralKernel kernelI = DerivativeIntegralImage.kernelHaarX(r, null);
        Kernel2D_F32 kernel = createHaarX(r);
        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.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Example 17 with ImageBorder_F32

use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelDerivYY.

@Test
void kernelDerivYY() {
    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.kernelDerivYY(size, null);
        Kernel2D_F32 kernel = createDerivXX(size);
        kernel = KernelMath.transpose(kernel);
        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.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Example 18 with ImageBorder_F32

use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelDerivXY.

@Test
void kernelDerivXY() {
    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.kernelDerivXY(size, null);
        Kernel2D_F32 kernel = createDerivXY(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.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Example 19 with ImageBorder_F32

use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelDerivY.

@Test
void kernelDerivY() {
    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 r = 1; r < 5; r++) {
        IntegralKernel kernelI = DerivativeIntegralImage.kernelDerivY(r, null);
        Kernel2D_F32 kernel = createDerivX(r);
        kernel = KernelMath.transpose(kernel);
        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.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Example 20 with ImageBorder_F32

use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.

the class TestDerivativeIntegralImage method kernelHaarY.

@Test
void kernelHaarY() {
    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++) {
        int size = i * 2;
        IntegralKernel kernelI = DerivativeIntegralImage.kernelHaarY(size, null);
        Kernel2D_F32 kernel = createHaarX(size);
        kernel = KernelMath.transpose(kernel);
        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.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Aggregations

ImageBorder_F32 (boofcv.struct.border.ImageBorder_F32)34 GrayF32 (boofcv.struct.image.GrayF32)25 Test (org.junit.jupiter.api.Test)17 Kernel2D_F32 (boofcv.struct.convolve.Kernel2D_F32)7 ImageBorder_S32 (boofcv.struct.border.ImageBorder_S32)2 GrayS16 (boofcv.struct.image.GrayS16)2 ImageGray (boofcv.struct.image.ImageGray)2 ScalePoint (boofcv.struct.feature.ScalePoint)1 Point2D_I16 (georegression.struct.point.Point2D_I16)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Random (java.util.Random)1