Search in sources :

Example 76 with ImageGray

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

the class TestPixelMath method testDividePixel.

private void testDividePixel(Method m) throws InvocationTargetException, IllegalAccessException {
    Class[] paramTypes = m.getParameterTypes();
    ImageGray inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
    ImageGray inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);
    ImageGray output = GeneralizedImageOps.createSingleBand(paramTypes[2], width, height);
    GImageMiscOps.fillUniform(inputA, rand, -20, 20);
    GImageMiscOps.fillUniform(inputB, rand, -20, 20);
    m.invoke(null, inputA, inputB, output);
    GImageGray a = FactoryGImageGray.wrap(inputA);
    GImageGray b = FactoryGImageGray.wrap(inputB);
    GImageGray o = FactoryGImageGray.wrap(output);
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            assertEquals(a.get(j, i).doubleValue() / b.get(j, i).doubleValue(), o.get(j, i).doubleValue(), 1e-4);
        }
    }
}
Also used : ImageGray(boofcv.struct.image.ImageGray)

Example 77 with ImageGray

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

the class TestPixelMath method testSqrt.

private void testSqrt(Method m) throws InvocationTargetException, IllegalAccessException {
    Class[] paramTypes = m.getParameterTypes();
    ImageGray inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
    ImageGray inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);
    GImageMiscOps.fillUniform(inputA, rand, -20, 20);
    GImageMiscOps.fillUniform(inputB, rand, -20, 20);
    m.invoke(null, inputA, inputB);
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            double a = GeneralizedImageOps.get(inputA, j, i);
            double b = GeneralizedImageOps.get(inputB, j, i);
            assertEquals(Math.sqrt(a), b, 1e-4);
        }
    }
}
Also used : ImageGray(boofcv.struct.image.ImageGray)

Example 78 with ImageGray

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

the class TestPixelMath method testLog.

private void testLog(Method m) throws InvocationTargetException, IllegalAccessException {
    Class[] paramTypes = m.getParameterTypes();
    ImageGray inputA = GeneralizedImageOps.createSingleBand(paramTypes[0], width, height);
    ImageGray inputB = GeneralizedImageOps.createSingleBand(paramTypes[1], width, height);
    GImageMiscOps.fillUniform(inputA, rand, -20, 20);
    GImageMiscOps.fillUniform(inputB, rand, -20, 20);
    m.invoke(null, inputA, inputB);
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            double a = GeneralizedImageOps.get(inputA, j, i);
            double b = GeneralizedImageOps.get(inputB, j, i);
            assertEquals(Math.log(1 + a), b, 1e-4);
        }
    }
}
Also used : ImageGray(boofcv.struct.image.ImageGray)

Example 79 with ImageGray

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

the class TestImplIntegralImageOps method block_unsafe.

public void block_unsafe(Method m) throws InvocationTargetException, IllegalAccessException {
    Class[] paramType = m.getParameterTypes();
    Class inputType = paramType[0];
    Class origType = inputType == GrayS32.class ? GrayU8.class : inputType;
    ImageGray input = GeneralizedImageOps.createSingleBand(origType, width, height);
    ImageGray integral = GeneralizedImageOps.createSingleBand(inputType, width, height);
    GImageMiscOps.fill(input, 1);
    GIntegralImageOps.transform(input, integral);
    double found0 = ((Number) m.invoke(null, integral, 4, 5, 8, 8)).doubleValue();
    assertEquals(12, found0, 1e-4f);
}
Also used : GImageGray(boofcv.core.image.GImageGray) FactoryGImageGray(boofcv.core.image.FactoryGImageGray) ImageGray(boofcv.struct.image.ImageGray) GrayS32(boofcv.struct.image.GrayS32)

Example 80 with ImageGray

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

the class TestImplIntegralImageOps method transform.

public void transform(Method m) {
    Class[] paramType = m.getParameterTypes();
    Class inputType = paramType[0];
    Class outputType = paramType[1];
    ImageGray input = GeneralizedImageOps.createSingleBand(inputType, width, height);
    ImageGray integral = GeneralizedImageOps.createSingleBand(outputType, width, height);
    GImageMiscOps.fillUniform(input, rand, 0, 100);
    BoofTesting.checkSubImage(this, "checkTransformResults", true, m, input, integral);
}
Also used : GImageGray(boofcv.core.image.GImageGray) FactoryGImageGray(boofcv.core.image.FactoryGImageGray) 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