Search in sources :

Example 6 with ImageBorder_S32

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

the class TestImplEnhanceFilter method sharpenBorder8.

public void sharpenBorder8(ImageGray input, ImageGray output) {
    ImageGray expected;
    GImageMiscOps.fillUniform(input, rand, 0, 10);
    if (input.getDataType().isInteger()) {
        BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder8", input, output, 0, 255);
        expected = new GrayS16(input.width, input.height);
        ImageBorder_S32 border = GImageDerivativeOps.borderDerivative_I32();
        border.setImage(input);
        ConvolveJustBorder_General_SB.convolve(EnhanceImageOps.kernelEnhance8_I32, border, (GrayS16) expected);
        GPixelMath.boundImage(expected, 0, 255);
    } else {
        BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder8", input, output, 0f, 255f);
        expected = new GrayF32(input.width, input.height);
        ImageBorder_F32 border = GImageDerivativeOps.borderDerivative_F32();
        border.setImage((GrayF32) input);
        ConvolveJustBorder_General_SB.convolve(EnhanceImageOps.kernelEnhance8_F32, border, (GrayF32) expected);
        GPixelMath.boundImage(expected, 0, 255);
    }
    BoofTesting.assertEquals(expected, output, 1e-5);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayS16(boofcv.struct.image.GrayS16) ImageGray(boofcv.struct.image.ImageGray) ImageBorder_F32(boofcv.struct.border.ImageBorder_F32) ImageBorder_S32(boofcv.struct.border.ImageBorder_S32)

Example 7 with ImageBorder_S32

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

the class TestDerivativeLaplacian_Inner method process_U8_S16.

public void process_U8_S16(GrayU8 img, GrayS16 deriv) {
    DerivativeLaplacian_Inner.process(img, deriv);
    ImageBorder_S32<GrayU8> border = (ImageBorder_S32) FactoryImageBorder.single(BorderType.EXTENDED, GrayU8.class);
    GrayS16 expected = deriv.createSameShape();
    ConvolveImage.convolve(DerivativeLaplacian.kernel_I32, img, expected, border);
    BoofTesting.assertEqualsInner(expected, deriv, 0, 1, 1, false);
}
Also used : GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder_S32(boofcv.struct.border.ImageBorder_S32)

Example 8 with ImageBorder_S32

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

the class TestGradientTwo0 method compareToConvolve_I8.

@Test
void compareToConvolve_I8() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(GradientTwo0.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
    validator.setKernel(0, GradientTwo0.kernelDeriv_I32, true);
    validator.setKernel(1, GradientTwo0.kernelDeriv_I32, false);
    GrayU8 input = new GrayU8(width, height);
    ImageMiscOps.fillUniform(input, rand, 0, 10);
    GrayS16 derivX = new GrayS16(width, height);
    GrayS16 derivY = new GrayS16(width, height);
    validator.compare(input, derivX, derivY);
}
Also used : GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder_S32(boofcv.struct.border.ImageBorder_S32) Test(org.junit.jupiter.api.Test)

Example 9 with ImageBorder_S32

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

the class TestGradientTwo0 method compareToConvolve_I16.

@Test
void compareToConvolve_I16() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(GradientTwo0.class.getMethod("process", GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
    validator.setKernel(0, GradientTwo0.kernelDeriv_I32, true);
    validator.setKernel(1, GradientTwo0.kernelDeriv_I32, false);
    GrayS16 input = new GrayS16(width, height);
    ImageMiscOps.fillUniform(input, rand, 0, 10);
    GrayS16 derivX = new GrayS16(width, height);
    GrayS16 derivY = new GrayS16(width, height);
    validator.compare(input, derivX, derivY);
}
Also used : GrayS16(boofcv.struct.image.GrayS16) ImageBorder_S32(boofcv.struct.border.ImageBorder_S32) Test(org.junit.jupiter.api.Test)

Example 10 with ImageBorder_S32

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

the class TestHessianThree method compareToConvolve_I8.

// TODO update to handle image border parameter
// @Test
// public void checkInputShape() {
// BoofTesting.checkImageDimensionReshape(new HessianThree(), 3);
// }
@Test
void compareToConvolve_I8() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(HessianThree.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
    validator.setKernel(0, HessianThree.kernelXXYY_I32, true);
    validator.setKernel(1, HessianThree.kernelXXYY_I32, false);
    validator.setKernel(2, HessianThree.kernelCross_I32);
    GrayU8 input = new GrayU8(width, height);
    ImageMiscOps.fillUniform(input, rand, 0, 10);
    GrayS16 derivXX = new GrayS16(width, height);
    GrayS16 derivYY = new GrayS16(width, height);
    GrayS16 derivXY = new GrayS16(width, height);
    validator.compare(input, derivXX, derivYY, derivXY);
}
Also used : GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder_S32(boofcv.struct.border.ImageBorder_S32) Test(org.junit.jupiter.api.Test)

Aggregations

ImageBorder_S32 (boofcv.struct.border.ImageBorder_S32)37 GrayS16 (boofcv.struct.image.GrayS16)23 GrayU8 (boofcv.struct.image.GrayU8)15 Test (org.junit.jupiter.api.Test)15 ImageGray (boofcv.struct.image.ImageGray)4 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)2 ImageRectangle (boofcv.struct.ImageRectangle)2 ImageBorder_F32 (boofcv.struct.border.ImageBorder_F32)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2 GrayF32 (boofcv.struct.image.GrayF32)2 GrayS32 (boofcv.struct.image.GrayS32)2