Search in sources :

Example 21 with ImageBorder_S32

use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.

the class TestHessianFromGradient method hessianPrewitt_I8.

@Test
public void hessianPrewitt_I8() throws NoSuchMethodException {
    CompareHessianToConvolution validator = new CompareHessianToConvolution();
    validator.setTarget(HessianFromGradient.class.getMethod("hessianPrewitt", GrayS16.class, GrayS16.class, GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
    validator.setKernel(0, GradientPrewitt.kernelDerivX_I32);
    validator.setKernel(1, GradientPrewitt.kernelDerivY_I32);
    GrayS16 derivX = new GrayS16(width, height);
    GrayS16 derivY = new GrayS16(width, height);
    ImageMiscOps.fillUniform(derivX, rand, -10, 10);
    ImageMiscOps.fillUniform(derivY, rand, -10, 10);
    GrayS16 derivXX = new GrayS16(width, height);
    GrayS16 derivYY = new GrayS16(width, height);
    GrayS16 derivXY = new GrayS16(width, height);
    validator.compare(derivX, derivY, derivXX, derivYY, derivXY);
}
Also used : GrayS16(boofcv.struct.image.GrayS16) ImageBorder_S32(boofcv.core.image.border.ImageBorder_S32) Test(org.junit.Test)

Example 22 with ImageBorder_S32

use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.

the class TestHessianFromGradient method hessianThree_I8.

@Test
public void hessianThree_I8() throws NoSuchMethodException {
    CompareHessianToConvolution validator = new CompareHessianToConvolution();
    validator.setTarget(HessianFromGradient.class.getMethod("hessianThree", GrayS16.class, GrayS16.class, GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
    validator.setKernel(0, GradientThree.kernelDeriv_I32, true);
    validator.setKernel(1, GradientThree.kernelDeriv_I32, false);
    GrayS16 derivX = new GrayS16(width, height);
    GrayS16 derivY = new GrayS16(width, height);
    ImageMiscOps.fillUniform(derivX, rand, -10, 10);
    ImageMiscOps.fillUniform(derivY, rand, -10, 10);
    GrayS16 derivXX = new GrayS16(width, height);
    GrayS16 derivYY = new GrayS16(width, height);
    GrayS16 derivXY = new GrayS16(width, height);
    validator.compare(derivX, derivY, derivXX, derivYY, derivXY);
}
Also used : GrayS16(boofcv.struct.image.GrayS16) ImageBorder_S32(boofcv.core.image.border.ImageBorder_S32) Test(org.junit.Test)

Example 23 with ImageBorder_S32

use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.

the class TestHessianSobel method compareToConvolve_I8.

@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(HessianSobel.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.class, ImageBorder_S32.class));
    validator.setKernel(0, HessianSobel.kernelXX_I32);
    validator.setKernel(1, HessianSobel.kernelYY_I32);
    validator.setKernel(2, HessianSobel.kernelXY_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.core.image.border.ImageBorder_S32) Test(org.junit.Test)

Example 24 with ImageBorder_S32

use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.

the class ImplBinaryBorderOps method dilate4.

public static void dilate4(GrayU8 input, GrayU8 output) {
    ImageBorder_S32 in = ImageBorderValue.wrap(input, 0);
    final int h = input.height - 1;
    final int w = input.width - 1;
    for (int x = 0; x < input.width; x++) {
        // check top edge
        if ((in.get(x, 0) + in.get(x - 1, 0) + in.get(x + 1, 0) + in.get(x, 1)) > 0)
            output.set(x, 0, 1);
        else
            output.set(x, 0, 0);
        // check bottom edge
        if ((in.get(x, h) + in.get(x - 1, h) + in.get(x + 1, h) + in.get(x, h - 1)) > 0)
            output.set(x, h, 1);
        else
            output.set(x, h, 0);
    }
    for (int y = 0; y < input.height; y++) {
        // check left edge
        if ((in.get(0, y) + in.get(1, y) + in.get(0, y - 1) + in.get(0, y + 1)) > 0)
            output.set(0, y, 1);
        else
            output.set(0, y, 0);
        // check right edge
        if ((in.get(w, y) + in.get(w - 1, y) + in.get(w, y - 1) + in.get(w, y + 1)) > 0)
            output.set(w, y, 1);
        else
            output.set(w, y, 0);
    }
}
Also used : ImageBorder_S32(boofcv.core.image.border.ImageBorder_S32)

Example 25 with ImageBorder_S32

use of boofcv.core.image.border.ImageBorder_S32 in project BoofCV by lessthanoptimal.

the class ImplBinaryBorderOps method dilate8.

public static void dilate8(GrayU8 input, GrayU8 output) {
    ImageBorder_S32 in = ImageBorderValue.wrap(input, 0);
    final int h = input.height - 1;
    final int w = input.width - 1;
    for (int x = 0; x < input.width; x++) {
        // check top edge
        if ((in.get(x, 0) + in.get(x - 1, 0) + in.get(x + 1, 0) + in.get(x - 1, 1) + in.get(x, 1) + in.get(x + 1, 1)) > 0)
            output.set(x, 0, 1);
        else
            output.set(x, 0, 0);
        // check bottom edge
        if ((in.get(x, h) + in.get(x - 1, h) + in.get(x + 1, h) + in.get(x - 1, h - 1) + in.get(x, h - 1) + in.get(x + 1, h - 1)) > 0)
            output.set(x, h, 1);
        else
            output.set(x, h, 0);
    }
    for (int y = 0; y < input.height; y++) {
        // check left edge
        if ((in.get(0, y) + in.get(1, y) + in.get(0, y - 1) + in.get(1, y - 1) + in.get(0, y + 1) + in.get(1, y + 1)) > 0)
            output.set(0, y, 1);
        else
            output.set(0, y, 0);
        // check right edge
        if ((in.get(w - 1, y) + in.get(w, y) + in.get(w - 1, y - 1) + in.get(w, y - 1) + in.get(w - 1, y + 1) + in.get(w, y + 1)) > 0)
            output.set(w, y, 1);
        else
            output.set(w, y, 0);
    }
}
Also used : ImageBorder_S32(boofcv.core.image.border.ImageBorder_S32)

Aggregations

ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)28 GrayS16 (boofcv.struct.image.GrayS16)15 Test (org.junit.Test)13 GrayU8 (boofcv.struct.image.GrayU8)8 ImageGray (boofcv.struct.image.ImageGray)4 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)2 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)2 GImageGray (boofcv.core.image.GImageGray)2 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)2 ImageRectangle (boofcv.struct.ImageRectangle)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2 GrayF32 (boofcv.struct.image.GrayF32)2 GrayS32 (boofcv.struct.image.GrayS32)2