Search in sources :

Example 11 with ImageGray

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

the class TestConvolveImageBox 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 12 with ImageGray

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

the class TestConvolveImageBox 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 13 with ImageGray

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

the class TestImplEnhanceFilter method sharpenBorder4.

/**
 * Compare the sharpen filter to a bounded convolution
 */
@Test
public void sharpenBorder4() {
    int numFound = 0;
    Method[] methods = ImplEnhanceFilter.class.getMethods();
    for (int i = 0; i < methods.length; i++) {
        if (methods[i].getName().compareTo("sharpenBorder4") != 0)
            continue;
        numFound++;
        Class imageType = methods[i].getParameterTypes()[0];
        ImageGray input = GeneralizedImageOps.createSingleBand(imageType, width, height);
        ImageGray output = GeneralizedImageOps.createSingleBand(imageType, width, height);
        sharpenBorder4(input, output);
        BoofTesting.checkSubImage(this, "sharpenBorder4", true, input, output);
    }
    assertEquals(2, numFound);
}
Also used : ImageGray(boofcv.struct.image.ImageGray) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 14 with ImageGray

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

the class TestImplEnhanceFilter method sharpenBorder4.

public void sharpenBorder4(ImageGray input, ImageGray output) {
    ImageGray expected;
    GImageMiscOps.fillUniform(input, rand, 0, 10);
    if (input.getDataType().isInteger()) {
        BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder4", input, output, 0, 255);
        expected = new GrayS16(input.width, input.height);
        ImageBorder_S32 border = BoofDefaults.borderDerivative_I32();
        border.setImage(input);
        ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance4_I32, border, (GrayS16) expected);
        GPixelMath.boundImage(expected, 0, 255);
    } else {
        BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder4", input, output, 0f, 255f);
        expected = new GrayF32(input.width, input.height);
        ImageBorder_F32 border = BoofDefaults.borderDerivative_F32();
        border.setImage((GrayF32) input);
        ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance4_F32, border, (GrayF32) expected);
        GPixelMath.boundImage(expected, 0, 255);
    }
    BoofTesting.assertEquals(expected, output, 1e-5);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayS16(boofcv.struct.image.GrayS16) ImageGray(boofcv.struct.image.ImageGray) ImageBorder_F32(boofcv.core.image.border.ImageBorder_F32) ImageBorder_S32(boofcv.core.image.border.ImageBorder_S32)

Example 15 with ImageGray

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

the class TestImplEnhanceFilter method sharpenBorder8.

public void sharpenBorder8(ImageGray input, ImageGray output) {
    ImageGray expected;
    GImageMiscOps.fillUniform(input, rand, 0, 10);
    if (input.getDataType().isInteger()) {
        BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder8", input, output, 0, 255);
        expected = new GrayS16(input.width, input.height);
        ImageBorder_S32 border = BoofDefaults.borderDerivative_I32();
        border.setImage(input);
        ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance8_I32, border, (GrayS16) expected);
        GPixelMath.boundImage(expected, 0, 255);
    } else {
        BoofTesting.callStaticMethod(ImplEnhanceFilter.class, "sharpenBorder8", input, output, 0f, 255f);
        expected = new GrayF32(input.width, input.height);
        ImageBorder_F32 border = BoofDefaults.borderDerivative_F32();
        border.setImage((GrayF32) input);
        ConvolveJustBorder_General_SB.convolve(ImplEnhanceFilter.kernelEnhance8_F32, border, (GrayF32) expected);
        GPixelMath.boundImage(expected, 0, 255);
    }
    BoofTesting.assertEquals(expected, output, 1e-5);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayS16(boofcv.struct.image.GrayS16) ImageGray(boofcv.struct.image.ImageGray) ImageBorder_F32(boofcv.core.image.border.ImageBorder_F32) ImageBorder_S32(boofcv.core.image.border.ImageBorder_S32)

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