Search in sources :

Example 51 with ImageBase

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

the class TestConvolveImage method reformatForValidation.

@Override
protected Object[] reformatForValidation(Method m, Object[] targetParam) {
    Object[] ret = new Object[] { targetParam[0], targetParam[1], targetParam[2] };
    ImageBase inputImage = (ImageBase) targetParam[1];
    KernelBase kernel = (KernelBase) targetParam[0];
    computeBorder(kernel, m.getName());
    int w = borderX0 + borderX1;
    int h = borderY0 + borderY1;
    ret[1] = inputImage.createNew(width + w, height + h);
    ret[2] = ((ImageBase) targetParam[2]).createNew(width + w, height + h);
    fillTestImage(inputImage, (ImageBase) ret[1], kernel, m.getName());
    return ret;
}
Also used : KernelBase(boofcv.struct.convolve.KernelBase) ImageBase(boofcv.struct.image.ImageBase)

Example 52 with ImageBase

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

the class TestConvolveJustBorder_General_IL method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    Class<?>[] paramTypes = candidate.getParameterTypes();
    KernelBase kernel = createKernel(paramTypes[0], kernelWidth, kernelWidth / 2);
    ImageBase src = ConvolutionTestHelper.createImage(validation.getParameterTypes()[1], width, height);
    GImageMiscOps.fillUniform(src, rand, 0, 5);
    ImageBase dst = ConvolutionTestHelper.createImage(validation.getParameterTypes()[2], width, height);
    Object[][] ret = new Object[2][paramTypes.length];
    // normal symmetric odd kernel
    ret[0][0] = kernel;
    ret[0][1] = InterleavedF32.class == src.getClass() ? ImageBorderValue.wrap((InterleavedF32) src, fillValue) : ImageBorderValue.wrap((InterleavedInteger) src, fillValue);
    ret[0][2] = dst;
    // change the offset
    kernel = createKernel(paramTypes[0], kernelWidth, kernelWidth / 2 - 1);
    ret[1][0] = kernel;
    ret[1][1] = InterleavedF32.class == src.getClass() ? ImageBorderValue.wrap((InterleavedF32) src, fillValue) : ImageBorderValue.wrap((InterleavedInteger) src, fillValue);
    ret[1][2] = ConvolutionTestHelper.createImage(validation.getParameterTypes()[2], width, height);
    return ret;
}
Also used : KernelBase(boofcv.struct.convolve.KernelBase) ImageBase(boofcv.struct.image.ImageBase)

Example 53 with ImageBase

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

the class TestClipAndReduce method massage_distorted.

/**
 * fill the center of the image with a single color.  If clipped correctly the output should be that color
 * entirely.  If not only the center
 */
private void massage_distorted(boolean clipped, ImageType type) {
    ImageBase input = type.createImage(40, 30);
    GImageMiscOps.fill(input.subimage(5, 0, 35, 30), 255);
    ImageBase output = type.createImage(20, 20);
    ClipAndReduce alg = new ClipAndReduce(clipped, type);
    alg.massage(input, output);
    if (clipped) {
        assertEquals(255, GeneralizedImageOps.get(output, 0, 10, 0), 1e-4);
        assertEquals(255, GeneralizedImageOps.get(output, 10, 10, 0), 1e-4);
        assertEquals(255, GeneralizedImageOps.get(output, 19, 10, 0), 1e-4);
    } else {
        assertEquals(0, GeneralizedImageOps.get(output, 0, 10, 0), 2);
        assertEquals(255, GeneralizedImageOps.get(output, 10, 10, 0), 1e-4);
        assertEquals(0, GeneralizedImageOps.get(output, 19, 10, 0), 2);
    }
}
Also used : ImageBase(boofcv.struct.image.ImageBase)

Example 54 with ImageBase

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

the class TestClipAndReduce method massage_written_to.

private void massage_written_to(boolean clipped, ImageType type) {
    ImageBase input = type.createImage(40, 30);
    GImageMiscOps.fillUniform(input, rand, -1, 1);
    ImageBase output = type.createImage(20, 20);
    ClipAndReduce alg = new ClipAndReduce(clipped, type);
    alg.massage(input, output);
    // make sure every pixel has been written to
    for (int y = 0; y < output.height; y++) {
        for (int x = 0; x < output.width; x++) {
            double value = GeneralizedImageOps.get(output, x, y, 0);
            assertTrue(value != 0);
        }
    }
}
Also used : ImageBase(boofcv.struct.image.ImageBase)

Aggregations

ImageBase (boofcv.struct.image.ImageBase)54 ImageType (boofcv.struct.image.ImageType)14 Test (org.junit.Test)13 Se3_F64 (georegression.struct.se.Se3_F64)5 BufferedImage (java.awt.image.BufferedImage)5 SimpleImageSequence (boofcv.io.image.SimpleImageSequence)4 GrayU8 (boofcv.struct.image.GrayU8)4 MediaManager (boofcv.io.MediaManager)3 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 DefaultMediaManager (boofcv.io.wrapper.DefaultMediaManager)3 KernelBase (boofcv.struct.convolve.KernelBase)3 Point2D_F64 (georegression.struct.point.Point2D_F64)3 ConfigBackgroundBasic (boofcv.factory.background.ConfigBackgroundBasic)2 ConfigBackgroundGmm (boofcv.factory.background.ConfigBackgroundGmm)2 ImageGridPanel (boofcv.gui.image.ImageGridPanel)2 ImagePanel (boofcv.gui.image.ImagePanel)2 GrayF32 (boofcv.struct.image.GrayF32)2 Planar (boofcv.struct.image.Planar)2 File (java.io.File)2 FDistort (boofcv.abst.distort.FDistort)1