Search in sources :

Example 96 with GrayU8

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

the class TestHessianSobel_Shared method compareToConvolve_I8.

@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(HessianSobel_Shared.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.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(false, input, derivXX, derivYY, derivXY);
}
Also used : CompareDerivativeToConvolution(boofcv.alg.filter.derivative.CompareDerivativeToConvolution) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 97 with GrayU8

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

the class TestHessianThree_Standard method compareToConvolve_I8.

@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
    CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
    validator.setTarget(HessianThree_Standard.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.class));
    validator.setKernel(0, HessianThree.kernelXXYY_I32, true);
    validator.setKernel(1, HessianThree.kernelXXYY_I32, false);
    validator.setKernel(2, HessianThree.kernelCross_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(false, input, derivXX, derivYY, derivXY);
}
Also used : CompareDerivativeToConvolution(boofcv.alg.filter.derivative.CompareDerivativeToConvolution) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 98 with GrayU8

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

the class TestGradientReduceToSingle method maxf_plfu8_u8.

@Test
public void maxf_plfu8_u8() {
    Planar<GrayU8> inX = new Planar<>(GrayU8.class, width, height, numbands);
    Planar<GrayU8> inY = new Planar<>(GrayU8.class, width, height, numbands);
    GrayU8 outX = new GrayU8(width, height);
    GrayU8 outY = new GrayU8(width, height);
    GImageMiscOps.fillUniform(inX, rand, 0, 100);
    GImageMiscOps.fillUniform(inY, rand, 0, 100);
    GradientReduceToSingle.maxf(inX, inY, outX, outY);
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int maxNorm = 0;
            int maxValueX = -Integer.MAX_VALUE;
            int maxValueY = -Integer.MAX_VALUE;
            for (int i = 0; i < numbands; i++) {
                int dx = inX.getBand(i).get(x, y);
                int dy = inY.getBand(i).get(x, y);
                int r = dx * dx + dy * dy;
                if (r > maxNorm) {
                    maxNorm = r;
                    maxValueX = dx;
                    maxValueY = dy;
                }
            }
            assertEquals(maxValueX, outX.get(x, y), 1e-4f);
            assertEquals(maxValueY, outY.get(x, y), 1e-4f);
        }
    }
}
Also used : Planar(boofcv.struct.image.Planar) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 99 with GrayU8

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

the class TestImplShiTomasiCorner_S16 method compareToNaive.

/**
 * Creates a random image and looks for corners in it.  Sees if the naive
 * and fast algorithm produce exactly the same results.
 */
@Test
public void compareToNaive() {
    GrayU8 img = new GrayU8(width, height);
    ImageMiscOps.fillUniform(img, new Random(0xfeed), 0, 100);
    GrayS16 derivX = new GrayS16(img.getWidth(), img.getHeight());
    GrayS16 derivY = new GrayS16(img.getWidth(), img.getHeight());
    GradientSobel.process(img, derivX, derivY, new ImageBorder1D_S32(BorderIndex1D_Extend.class));
    BoofTesting.checkSubImage(this, "compareToNaive", true, derivX, derivY);
}
Also used : Random(java.util.Random) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) Test(org.junit.Test)

Example 100 with GrayU8

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

the class TestImplShiTomasiCornerWeighted_F32 method compareToNaive.

/**
 * Sees if the integer version and this version produce the same results.
 * <p/>
 * Creates a random image and looks for corners in it.  Sees if the naive
 * and fast algorithm produce exactly the same results.
 */
@Test
public void compareToNaive() {
    GrayU8 img = new GrayU8(width, height);
    ImageMiscOps.fillUniform(img, new Random(0xfeed), 0, 100);
    GrayS16 derivX_I = new GrayS16(img.getWidth(), img.getHeight());
    GrayS16 derivY_I = new GrayS16(img.getWidth(), img.getHeight());
    GradientSobel.process(img, derivX_I, derivY_I, new ImageBorder1D_S32(BorderIndex1D_Extend.class));
    GrayF32 derivX_F = ConvertImage.convert(derivX_I, (GrayF32) null);
    GrayF32 derivY_F = ConvertImage.convert(derivY_I, (GrayF32) null);
    BoofTesting.checkSubImage(this, "compareToNaive", true, derivX_F, derivY_F);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Random(java.util.Random) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) 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