Search in sources :

Example 41 with ImageGray

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

the class TestImplConvolveBox method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    Class[] c = candidate.getParameterTypes();
    ImageGray input = GeneralizedImageOps.createSingleBand(c[0], width, height);
    ImageGray output = GeneralizedImageOps.createSingleBand(c[1], width, height);
    GImageMiscOps.fillUniform(input, rand, 0, 20);
    Object[][] ret = new Object[1][];
    ret[0] = new Object[] { input, output, kernelRadius };
    return ret;
}
Also used : ImageGray(boofcv.struct.image.ImageGray)

Example 42 with ImageGray

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

the class TestImplConvolveBox method compareResults.

@Override
protected void compareResults(Object targetResult, Object[] targetParam, Object validationResult, Object[] validationParam) {
    ImageGray expected = (ImageGray) validationParam[2];
    ImageGray found = (ImageGray) targetParam[1];
    BoofTesting.assertEquals(expected, found, 1e-4);
}
Also used : ImageGray(boofcv.struct.image.ImageGray)

Example 43 with ImageGray

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

the class TestImplAverageDownSample method horizontal_2_to_1.

/**
 * Two pixels should be averaged together at a time
 */
@Test
public void horizontal_2_to_1() throws InvocationTargetException, IllegalAccessException {
    List<Method> methods = find("horizontal");
    for (Method m : methods) {
        Class typeSrc = m.getParameterTypes()[0];
        Class typeDst = m.getParameterTypes()[1];
        ImageGray src = GeneralizedImageOps.createSingleBand(typeSrc, 6, 3);
        ImageGray dst = GeneralizedImageOps.createSingleBand(typeDst, 3, 3);
        fillHorizontal(src);
        m.invoke(null, src, dst);
        for (int y = 0; y < src.height; y++) {
            assertEquals(0.5f, GeneralizedImageOps.get(dst, 0, y), 1e-4f);
            assertEquals(2.5f, GeneralizedImageOps.get(dst, 1, y), 1e-4f);
            assertEquals(4.5f, GeneralizedImageOps.get(dst, 2, y), 1e-4f);
        }
    }
    assertEquals(4, methods.size());
}
Also used : ImageGray(boofcv.struct.image.ImageGray) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 44 with ImageGray

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

the class TestImplAverageDownSample method horizontal_1_to_1.

/**
 * easy case, should be a perfect copy
 */
@Test
public void horizontal_1_to_1() throws InvocationTargetException, IllegalAccessException {
    List<Method> methods = find("horizontal");
    for (Method m : methods) {
        Class typeSrc = m.getParameterTypes()[0];
        Class typeDst = m.getParameterTypes()[1];
        ImageGray src = GeneralizedImageOps.createSingleBand(typeSrc, 6, 3);
        ImageGray dst = GeneralizedImageOps.createSingleBand(typeDst, 6, 3);
        fillHorizontal(src);
        m.invoke(null, src, dst);
        for (int y = 0; y < src.height; y++) {
            for (int x = 0; x < src.width; x++) {
                double found = GeneralizedImageOps.get(dst, x, y);
                assertEquals(x, found, 1e-4f);
            }
        }
    }
    assertEquals(4, methods.size());
}
Also used : ImageGray(boofcv.struct.image.ImageGray) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 45 with ImageGray

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

the class TestConvolveImageMean method reformatForValidation.

@Override
protected Object[] reformatForValidation(Method m, Object[] targetParam) {
    Class<?>[] params = m.getParameterTypes();
    int radius = (Integer) targetParam[2];
    Object kernel = createTableKernel(params[0], radius);
    ImageGray output = (ImageGray) ((ImageGray) targetParam[1]).clone();
    return new Object[] { kernel, targetParam[0], output };
}
Also used : ImageGray(boofcv.struct.image.ImageGray)

Aggregations

ImageGray (boofcv.struct.image.ImageGray)110 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)43 GImageGray (boofcv.core.image.GImageGray)43 Test (org.junit.Test)26 GrayF32 (boofcv.struct.image.GrayF32)20 Method (java.lang.reflect.Method)17 GrayU8 (boofcv.struct.image.GrayU8)15 Bitmap (android.graphics.Bitmap)4 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)4 GrayS16 (boofcv.struct.image.GrayS16)4 GrayS32 (boofcv.struct.image.GrayS32)4 Planar (boofcv.struct.image.Planar)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)3 ImageRectangle (boofcv.struct.ImageRectangle)3 FDistort (boofcv.abst.distort.FDistort)2 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)2 FactoryDescribeImageDense (boofcv.factory.feature.dense.FactoryDescribeImageDense)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)2