Search in sources :

Example 31 with GrayU8

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

the class CompareToBinaryNaive method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    GrayU8 input = new GrayU8(width, height);
    GrayU8 output = new GrayU8(width, height);
    ImageMiscOps.fillUniform(input, rand, 0, 1);
    if (isSpecialFunction(candidate)) {
        return new Object[][] { { input, 1, output } };
    } else {
        return new Object[][] { { input, output } };
    }
}
Also used : GrayU8(boofcv.struct.image.GrayU8)

Example 32 with GrayU8

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

the class TestImplMedianSortNaive method trivialTest.

@Test
public void trivialTest() {
    GrayU8 templateImage = new GrayU8(4, 4);
    for (int i = 0; i < templateImage.width; i++) {
        for (int j = 0; j < templateImage.height; j++) {
            templateImage.set(j, i, i * templateImage.width + j);
        }
    }
    int numFound = 0;
    Method[] methods = ImplMedianSortNaive.class.getMethods();
    for (Method m : methods) {
        if (!m.getName().equals("process"))
            continue;
        if (m.getParameterTypes().length != 4)
            continue;
        Class[] params = m.getParameterTypes();
        ImageGray input = GeneralizedImageOps.createSingleBand(params[0], 4, 4);
        ImageGray found = GeneralizedImageOps.createSingleBand(params[1], 4, 4);
        GConvertImage.convert(templateImage, input);
        BoofTesting.checkSubImage(this, "trivialTest", true, m, input, found);
        numFound++;
    }
    assertEquals(2, numFound);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) FactoryGImageGray(boofcv.core.image.FactoryGImageGray) ImageGray(boofcv.struct.image.ImageGray) GImageGray(boofcv.core.image.GImageGray) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 33 with GrayU8

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

the class GenericThresholdCommon method widthLargerThanImage.

@Test(expected = IllegalArgumentException.class)
public void widthLargerThanImage() {
    T input = GeneralizedImageOps.createSingleBand(imageType, 10, 12);
    GrayU8 output = new GrayU8(10, 12);
    InputToBinary<T> alg = createAlg(20, 1.0, true);
    alg.process(input, output);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 34 with GrayU8

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

the class GenericThresholdCommon method subImage.

@Test
public void subImage() {
    T input = GeneralizedImageOps.createSingleBand(imageType, 100, 120);
    GImageMiscOps.fillUniform(input, rand, 0, 255);
    GrayU8 expected = new GrayU8(100, 120);
    T sub_input = BoofTesting.createSubImageOf(input);
    GrayU8 sub_output = BoofTesting.createSubImageOf(expected);
    InputToBinary<T> alg = createAlg(14, 1.0, true);
    alg.process(input, expected);
    alg.process(sub_input, sub_output);
    BoofTesting.assertEquals(expected, sub_output, 0);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 35 with GrayU8

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

the class GenericThresholdCommon method toggleDown.

@Test
public void toggleDown() {
    T input = GeneralizedImageOps.createSingleBand(imageType, 100, 120);
    GImageMiscOps.fillUniform(input, rand, 0, 255);
    GrayU8 down = new GrayU8(100, 120);
    GrayU8 up = new GrayU8(100, 120);
    // turn off texture so that the output's can be the inverse of each other
    createAlg(6, 1.0, true).process(input, down);
    createAlg(6, 1.0, false).process(input, up);
    for (int y = 0; y < down.height; y++) {
        for (int x = 0; x < down.width; x++) {
            assertTrue(x + " " + y, (down.get(x, y) == 0) == !(up.get(x, y) == 0));
        }
    }
}
Also used : 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