Search in sources :

Example 26 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestGradientMultiToSingleBand_Reflection method expected.

/**
 * Pass in a simple method and see if it is invoked correctly
 */
@Test
public void expected() {
    try {
        Method m = getClass().getMethod("helper", Planar.class, Planar.class, GrayF32.class, GrayF32.class);
        GradientMultiToSingleBand_Reflection alg = new GradientMultiToSingleBand_Reflection(m, ImageType.pl(3, GrayF32.class), GrayF32.class);
        assertTrue(alg.getInputType().getFamily() == ImageType.Family.PLANAR);
        assertTrue(alg.getOutputType() == GrayF32.class);
        Planar<GrayF32> inX = new Planar<>(GrayF32.class, 10, 12, 3);
        Planar<GrayF32> inY = new Planar<>(GrayF32.class, 10, 12, 3);
        GrayF32 outX = new GrayF32(10, 12);
        GrayF32 outY = new GrayF32(10, 12);
        alg.process(inX, inY, outX, outY);
        assertEquals(2, outX.data[5], 1e-4f);
        assertEquals(3, outY.data[5], 1e-4f);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Planar(boofcv.struct.image.Planar) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 27 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestImageGradient_Reflection method testNoException.

/**
 * See if it throws an exception or not
 */
@Test
public void testNoException() throws NoSuchMethodException {
    GrayF32 input = new GrayF32(width, height);
    GrayF32 derivX = new GrayF32(width, height);
    GrayF32 derivY = new GrayF32(width, height);
    Method m = GradientSobel.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class);
    ImageGradient_Reflection<GrayF32, GrayF32> alg = new ImageGradient_Reflection<>(m);
    alg.process(input, derivX, derivY);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 28 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestImageHessianDirect_Reflection method testNoException.

/**
 * See if it throws an exception or not
 */
@Test
public void testNoException() throws NoSuchMethodException {
    GrayF32 input = new GrayF32(width, height);
    GrayF32 derivXX = new GrayF32(width, height);
    GrayF32 derivYY = new GrayF32(width, height);
    GrayF32 derivXY = new GrayF32(width, height);
    Method m = HessianSobel.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class);
    ImageHessianDirect_Reflection<GrayF32, GrayF32> alg = new ImageHessianDirect_Reflection<>(m);
    alg.process(input, derivXX, derivYY, derivXY);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 29 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestUtilDenoiseWavelet method universalThreshold.

@Test
public void universalThreshold() {
    GrayF32 image = new GrayF32(width, height);
    double sigma = 12;
    double found = UtilDenoiseWavelet.universalThreshold(image, sigma);
    double expected = sigma * Math.sqrt(2.0 * Math.log(height));
    assertEquals(expected, found, 1e-4);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.Test)

Example 30 with GrayF32

use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.

the class TestInterpolatePixel_PL_using_SB method compareToIndividual.

@Test
public void compareToIndividual() {
    GrayF32 image0 = new GrayF32(width, height);
    GrayF32 image1 = new GrayF32(width, height);
    ImageMiscOps.fillUniform(image0, rand, 0, 100);
    ImageMiscOps.fillUniform(image1, rand, 0, 100);
    InterpolatePixelS<GrayF32> interpA = FactoryInterpolation.bilinearPixelS(GrayF32.class, BorderType.EXTENDED);
    InterpolatePixelS<GrayF32> interpB = FactoryInterpolation.bilinearPixelS(GrayF32.class, BorderType.EXTENDED);
    InterpolatePixelMB<Planar<GrayF32>> alg = new InterpolatePixel_PL_using_SB<>(interpB);
    Planar<GrayF32> mb = new Planar<>(GrayF32.class, width, height, 2);
    mb.bands[0] = image0;
    mb.bands[1] = image1;
    alg.setImage(mb);
    float[] vals = new float[2];
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            float xx = (rand.nextFloat() - 0.5f) + x;
            float yy = (rand.nextFloat() - 0.5f) + y;
            if (xx < 0)
                xx = 0;
            else if (xx > width - 1)
                xx = width - 1;
            if (yy < 0)
                yy = 0;
            else if (yy > height - 1)
                yy = height - 1;
            alg.get(xx, yy, vals);
            interpA.setImage(image0);
            float expected0 = interpA.get(xx, yy);
            interpA.setImage(image1);
            float expected1 = interpA.get(xx, yy);
            assertEquals(expected0, vals[0], 1e-4);
            assertEquals(expected1, vals[1], 1e-4);
        }
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Planar(boofcv.struct.image.Planar) Test(org.junit.Test)

Aggregations

GrayF32 (boofcv.struct.image.GrayF32)530 Test (org.junit.Test)291 BufferedImage (java.awt.image.BufferedImage)81 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)76 GrayU8 (boofcv.struct.image.GrayU8)49 Planar (boofcv.struct.image.Planar)34 ArrayList (java.util.ArrayList)28 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)20 ImageGray (boofcv.struct.image.ImageGray)20 File (java.io.File)20 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)19 Se3_F64 (georegression.struct.se.Se3_F64)18 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)17 GrayS8 (boofcv.struct.image.GrayS8)16 ListDisplayPanel (boofcv.gui.ListDisplayPanel)14 PathLabel (boofcv.io.PathLabel)14 Kernel2D_F32 (boofcv.struct.convolve.Kernel2D_F32)13 GrayS16 (boofcv.struct.image.GrayS16)13 GrayS32 (boofcv.struct.image.GrayS32)13 Point2D_F64 (georegression.struct.point.Point2D_F64)13