Search in sources :

Example 6 with ImageBorder_F32

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

the class TestHessianThree method compareToConvolve_F32.

@Test
void compareToConvolve_F32() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(HessianThree.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class));
    validator.setKernel(0, HessianThree.kernelXXYY_F32, true);
    validator.setKernel(1, HessianThree.kernelXXYY_F32, false);
    validator.setKernel(2, HessianThree.kernelCross_F32);
    GrayF32 input = new GrayF32(width, height);
    ImageMiscOps.fillUniform(input, rand, 0, 10);
    GrayF32 derivXX = new GrayF32(width, height);
    GrayF32 derivYY = new GrayF32(width, height);
    GrayF32 derivXY = new GrayF32(width, height);
    validator.compare(input, derivXX, derivYY, derivXY);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageBorder_F32(boofcv.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Example 7 with ImageBorder_F32

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

the class TestHessianFromGradient method hessianPrewitt_F32.

@Test
void hessianPrewitt_F32() throws NoSuchMethodException {
    CompareHessianToConvolution validator = new CompareHessianToConvolution();
    validator.setTarget(HessianFromGradient.class.getMethod("hessianPrewitt", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class));
    validator.setKernel(0, GradientPrewitt.kernelDerivX_F32);
    validator.setKernel(1, GradientPrewitt.kernelDerivY_F32);
    GrayF32 derivX = new GrayF32(width, height);
    GrayF32 derivY = new GrayF32(width, height);
    ImageMiscOps.fillUniform(derivX, rand, -10, 10);
    ImageMiscOps.fillUniform(derivY, rand, -10, 10);
    GrayF32 derivXX = new GrayF32(width, height);
    GrayF32 derivYY = new GrayF32(width, height);
    GrayF32 derivXY = new GrayF32(width, height);
    validator.compare(derivX, derivY, derivXX, derivYY, derivXY);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageBorder_F32(boofcv.struct.border.ImageBorder_F32) Test(org.junit.jupiter.api.Test)

Example 8 with ImageBorder_F32

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

the class TestHessianFromGradient method hessianThree_F32.

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

Example 9 with ImageBorder_F32

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

the class TestHessianThreeDeterminant_Border method hessianDetFromConv_F32_F32.

public static GrayF32 hessianDetFromConv_F32_F32(GrayF32 img) {
    ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorder.single(BorderType.EXTENDED, GrayF32.class);
    GrayF32 Lxx = new GrayF32(img.width, img.height);
    GrayF32 Lyy = new GrayF32(img.width, img.height);
    GrayF32 Lxy = new GrayF32(img.width, img.height);
    ConvolveImage.horizontal(HessianThree.kernelXXYY_F32, img, Lxx, border);
    ConvolveImage.vertical(HessianThree.kernelXXYY_F32, img, Lyy, border);
    ConvolveImage.convolve(HessianThree.kernelCross_F32, img, Lxy, border);
    GrayF32 expected = new GrayF32(img.width, img.height);
    for (int y = 0; y < img.height; y++) {
        for (int x = 0; x < img.width; x++) {
            expected.data[expected.getIndex(x, y)] = 4 * (Lxx.get(x, y) * Lyy.get(x, y) - Lxy.get(x, y) * Lxy.get(x, y));
        }
    }
    return expected;
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageBorder_F32(boofcv.struct.border.ImageBorder_F32)

Example 10 with ImageBorder_F32

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

the class TestHessianThreeDeterminant_Border method process_F32.

public void process_F32(GrayF32 img, GrayF32 deriv) {
    ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorder.single(BorderType.EXTENDED, GrayF32.class);
    HessianThreeDeterminant_Border.process(img, deriv, border);
    GrayF32 expected = hessianDetFromConv_F32_F32(img);
    BoofTesting.assertEqualsBorder(expected, deriv, 1e-4, 2, 2);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) ImageBorder_F32(boofcv.struct.border.ImageBorder_F32)

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