Search in sources :

Example 91 with GrayU8

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

the class TestImageLineIntegral method inside_nonZero.

/**
 * See if it calculates the integral correctly inside a single pixel
 */
@Test
public void inside_nonZero() {
    GrayU8 img = new GrayU8(10, 15);
    ImageMiscOps.fill(img, 255);
    img.set(6, 6, 100);
    alg.setImage(FactoryGImageGray.wrap(img));
    // entirely inside
    double r = Math.sqrt(0.1 * 0.1 + 0.2 * 0.2);
    checkSolution(6.1, 6.2, 6.2, 6.4, r * 100);
    checkSolution(6.2, 6.1, 6.4, 6.2, r * 100);
    // one entire diagonal
    checkSolution(6, 6, 7, 7, sqrt(2) * 100);
    checkSolution(6, 7, 7, 6, sqrt(2) * 100);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 92 with GrayU8

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

the class TestImageLineIntegral method nearBorder_nonZero.

/**
 * See if it handles borders correctly with both slopes are not zero
 */
@Test
public void nearBorder_nonZero() {
    GrayU8 img = new GrayU8(2, 2);
    img.set(0, 0, 100);
    img.set(0, 1, 200);
    img.set(1, 0, 140);
    img.set(1, 1, 150);
    alg.setImage(FactoryGImageGray.wrap(img));
    checkSolution(0, 0, 2, 2, sqrt(2) * (100 + 150));
    checkSolution(2, 0, 0, 2, sqrt(2) * (200 + 140));
    // two squares horizontal and vertical
    double r = Math.sqrt(1 + 4) / 2;
    checkSolution(0, 0, 2, 1, r * (100 + 140));
    checkSolution(0, 0, 1, 2, r * (100 + 200));
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 93 with GrayU8

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

the class TestImageLineIntegral method zeroLengthLine.

/**
 * The same two points are passed in for the end points
 */
@Test
public void zeroLengthLine() {
    GrayU8 img = new GrayU8(10, 15);
    img.set(6, 6, 100);
    alg.setImage(FactoryGImageGray.wrap(img));
    checkSolution(6, 6, 6, 6, 0);
    checkSolution(6.1, 6.1, 6.1, 6.1, 0);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 94 with GrayU8

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

the class TestImageLineIntegral method inside_SlopeZero.

/**
 * Tests an integral inside a single pixel where x or y slope is zero
 */
@Test
public void inside_SlopeZero() {
    GrayU8 img = new GrayU8(10, 15);
    img.set(6, 6, 100);
    alg.setImage(FactoryGImageGray.wrap(img));
    checkSolution(6.5, 6, 6.5, 7, 100);
    checkSolution(6.5, 6, 6.5, 6.9, 0.9 * 100);
    checkSolution(6.5, 6.1, 6.5, 7.0, 0.9 * 100);
    checkSolution(6, 6.5, 7, 6.5, 100);
    checkSolution(6, 6.5, 6.9, 6.5, 0.9 * 100);
    checkSolution(6.1, 6.5, 7, 6.5, 0.9 * 100);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 95 with GrayU8

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

the class TestGradientTwo1_Standard method compareToConvolve_I8.

@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(GradientTwo1_Standard.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class));
    validator.setKernel(0, GradientTwo1.kernelDeriv_I32, true);
    validator.setKernel(1, GradientTwo1.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(false, input, derivX, derivY);
}
Also used : CompareDerivativeToConvolution(boofcv.alg.filter.derivative.CompareDerivativeToConvolution) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Aggregations

GrayU8 (boofcv.struct.image.GrayU8)417 Test (org.junit.Test)242 BufferedImage (java.awt.image.BufferedImage)53 GrayS32 (boofcv.struct.image.GrayS32)52 GrayF32 (boofcv.struct.image.GrayF32)49 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)48 GrayS16 (boofcv.struct.image.GrayS16)45 Planar (boofcv.struct.image.Planar)28 ArrayList (java.util.ArrayList)22 File (java.io.File)17 ListDisplayPanel (boofcv.gui.ListDisplayPanel)16 RectangleLength2D_I32 (georegression.struct.shapes.RectangleLength2D_I32)16 ImageGray (boofcv.struct.image.ImageGray)15 EllipseRotated_F64 (georegression.struct.curve.EllipseRotated_F64)15 Random (java.util.Random)14 Point2D_F64 (georegression.struct.point.Point2D_F64)11 ImageRectangle (boofcv.struct.ImageRectangle)10 GrayU16 (boofcv.struct.image.GrayU16)10 Se3_F64 (georegression.struct.se.Se3_F64)10 Point3D_F64 (georegression.struct.point.Point3D_F64)9