Search in sources :

Example 16 with ImageGray

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

the class TestImplEnhanceFilter method sharpenBorder8.

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

Example 17 with ImageGray

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

the class TestImplEnhanceFilter method sharpenInner4.

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

Example 18 with ImageGray

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

the class TestImplEnhanceFilter method sharpenInner8.

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

Example 19 with ImageGray

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

the class TestImplEnhanceHistogram method applyTransform.

@Test
public void applyTransform() {
    int numFound = 0;
    Method[] methods = ImplEnhanceHistogram.class.getMethods();
    for (int i = 0; i < methods.length; i++) {
        if (methods[i].getName().compareTo("applyTransform") != 0)
            continue;
        numFound++;
        Class imageType = methods[i].getParameterTypes()[0];
        ImageGray input = GeneralizedImageOps.createSingleBand(imageType, width, height);
        ImageGray output = GeneralizedImageOps.createSingleBand(imageType, width, height);
        applyTransform(input, output);
        BoofTesting.checkSubImage(this, "applyTransform", true, input, output);
    }
    assertEquals(5, numFound);
}
Also used : ImageGray(boofcv.struct.image.ImageGray) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 20 with ImageGray

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

the class TestImplGrayImageOps method stretch.

public void stretch(Method m) throws InvocationTargetException, IllegalAccessException {
    Class[] param = m.getParameterTypes();
    ImageGray input = GeneralizedImageOps.createSingleBand(param[0], width, height);
    ImageGray output = GeneralizedImageOps.createSingleBand(param[0], width, height);
    GImageMiscOps.fill(input, 23);
    m.invoke(null, input, 2.5, 10, 255, output);
    GImageGray b = FactoryGImageGray.wrap(output);
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            if (output.getDataType().isInteger())
                assertEquals(67, b.get(x, y).doubleValue(), 1e-4);
            else
                assertEquals(67.5, b.get(x, y).doubleValue(), 1e-4);
        }
    }
    // check to see how well it sets the ceiling
    m.invoke(null, input, 10, 28, 255, output);
    assertEquals(255, b.get(5, 6).doubleValue(), 1e-4);
    // check it flooring to zero
    m.invoke(null, input, -1, 2, 255, output);
    assertEquals(0, b.get(5, 6).doubleValue(), 1e-4);
}
Also used : FactoryGImageGray(boofcv.core.image.FactoryGImageGray) GImageGray(boofcv.core.image.GImageGray) FactoryGImageGray(boofcv.core.image.FactoryGImageGray) ImageGray(boofcv.struct.image.ImageGray) GImageGray(boofcv.core.image.GImageGray)

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