Search in sources :

Example 21 with GrayF32

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

the class TestImageDistortBasic_SB method applyRenderAll_true.

@Test
public void applyRenderAll_true() {
    Helper alg = new Helper(interp);
    alg.setRenderAll(true);
    offX = offY = 0;
    alg.reset();
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(150, alg.getTotal());
    offX = offY = 0.1f;
    alg.reset();
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(150, alg.getTotal());
    offX = offY = -0.1f;
    alg.reset();
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(150, alg.getTotal());
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.Test)

Example 22 with GrayF32

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

the class TestImageDistortBasic_SB method applyRenderAll_False.

@Test
public void applyRenderAll_False() {
    Helper alg = new Helper(interp);
    alg.setRenderAll(false);
    offX = offY = 0;
    alg.reset();
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(150, alg.getTotal());
    offX = offY = 0.1f;
    alg.reset();
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(9 * 14, alg.getTotal());
    offX = offY = -0.1f;
    alg.reset();
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(9 * 14, alg.getTotal());
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.Test)

Example 23 with GrayF32

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

the class TestImageDistortCache_SB method apply_setRenderAll.

@Test
public void apply_setRenderAll() {
    Helper alg = new Helper(interp);
    offX = offY = 0;
    alg.reset();
    alg.setRenderAll(true);
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(150, alg.getTotal());
    offX = offY = 0.1f;
    alg.reset();
    alg.setRenderAll(false);
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(9 * 14, alg.getTotal());
    offX = offY = -0.1f;
    alg.reset();
    alg.setRenderAll(false);
    alg.setModel(tran);
    alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
    assertEquals(9 * 14, alg.getTotal());
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.Test)

Example 24 with GrayF32

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

the class TestAnyImageDerivative method test.

@Test
public void test() {
    ImageGradient<GrayF32, GrayF32> g = FactoryDerivative.three(GrayF32.class, null);
    GrayF32 derivX = new GrayF32(width, height);
    GrayF32 derivY = new GrayF32(width, height);
    GrayF32 derivXX = new GrayF32(width, height);
    GrayF32 derivYY = new GrayF32(width, height);
    GrayF32 derivXY = new GrayF32(width, height);
    GrayF32 derivYX = new GrayF32(width, height);
    GrayF32 derivYYX = new GrayF32(width, height);
    GrayF32 derivYYY = new GrayF32(width, height);
    GImageMiscOps.fillUniform(original, rand, 0, 40);
    g.process(original, derivX, derivY);
    g.process(derivX, derivXX, derivXY);
    g.process(derivY, derivYX, derivYY);
    g.process(derivYY, derivYYX, derivYYY);
    Kernel1D_F32 kernelX = (Kernel1D_F32) GradientThree.getKernelX(false);
    AnyImageDerivative<GrayF32, GrayF32> alg = new AnyImageDerivative<>(kernelX, GrayF32.class, GrayF32.class);
    alg.setInput(original);
    // do one out of order which will force it to meet all the dependencies
    BoofTesting.assertEquals(derivYYY, alg.getDerivative(false, false, false), 1e-4);
    BoofTesting.assertEquals(derivX, alg.getDerivative(true), 1e-4);
    BoofTesting.assertEquals(derivY, alg.getDerivative(false), 1e-4);
    BoofTesting.assertEquals(derivXX, alg.getDerivative(true, true), 1e-4);
    BoofTesting.assertEquals(derivXY, alg.getDerivative(true, false), 1e-4);
    BoofTesting.assertEquals(derivYY, alg.getDerivative(false, false), 1e-4);
    BoofTesting.assertEquals(derivYYX, alg.getDerivative(false, false, true), 1e-4);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Kernel1D_F32(boofcv.struct.convolve.Kernel1D_F32) Test(org.junit.Test)

Example 25 with GrayF32

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

the class TestAnyImageDerivative method changeInputImageSize.

/**
 * See if changing the input image size causes an exception to be thrown.
 */
@Test
public void changeInputImageSize() {
    Kernel1D_F32 kernelX = (Kernel1D_F32) GradientThree.getKernelX(false);
    AnyImageDerivative<GrayF32, GrayF32> alg = new AnyImageDerivative<>(kernelX, GrayF32.class, GrayF32.class);
    alg.setInput(original);
    alg.getDerivative(true);
    GrayF32 smaller = new GrayF32(width - 5, height - 5);
    GImageMiscOps.fillUniform(smaller, rand, 0, 40);
    // assume that if it can't handle variable sized inputs then an exception is thrown
    alg.setInput(smaller);
    alg.getDerivative(true);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Kernel1D_F32(boofcv.struct.convolve.Kernel1D_F32) 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