Search in sources :

Example 46 with ImageBase

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

the class ExampleWebcamJavaCV method main.

public static void main(String[] args) {
    WebcamOpenCV webcam = new WebcamOpenCV();
    SimpleImageSequence sequence = webcam.open("0", 1280, 960, ImageType.pl(3, GrayU8.class));
    BufferedImage output = new BufferedImage(sequence.getNextWidth(), sequence.getNextHeight(), BufferedImage.TYPE_INT_RGB);
    ImagePanel gui = new ImagePanel(output);
    ShowImages.showWindow(gui, "Webam using JavaCV", true);
    while (sequence.hasNext()) {
        ImageBase gray = sequence.next();
        ConvertBufferedImage.convertTo(gray, output, true);
        gui.repaint();
    }
}
Also used : SimpleImageSequence(boofcv.io.image.SimpleImageSequence) GrayU8(boofcv.struct.image.GrayU8) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) ImageBase(boofcv.struct.image.ImageBase) ImagePanel(boofcv.gui.image.ImagePanel)

Example 47 with ImageBase

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

the class CompareToStandardConvolutionNormalized method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    Class<?>[] paramTypes = candidate.getParameterTypes();
    Object[][] ret = new Object[1][paramTypes.length];
    ret[0][0] = FactoryKernel.random((Class) paramTypes[0], kernelRadius, 1, 10, rand);
    ((KernelBase) ret[0][0]).offset = offset;
    int index = 1;
    if (KernelBase.class.isAssignableFrom(paramTypes[1])) {
        ret[0][index] = FactoryKernel.random((Class) paramTypes[1], kernelRadius, 1, 10, rand);
        ((KernelBase) ret[0][index]).offset = offset;
        index++;
    }
    ImageBase src = ConvolutionTestHelper.createImage(paramTypes[index], width, height);
    ret[0][index++] = src;
    GImageMiscOps.fillUniform(src, rand, 0, 120);
    ImageBase dst = ConvolutionTestHelper.createImage(paramTypes[index], width, height);
    ret[0][index] = dst;
    return ret;
}
Also used : ImageBase(boofcv.struct.image.ImageBase)

Example 48 with ImageBase

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

the class CompareToStandardConvolveDownNoBorder method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    Class<?>[] paramTypes = candidate.getParameterTypes();
    Object kernel = FactoryKernel.random(paramTypes[0], kernelRadius, 0, 10, rand);
    int divW, divH;
    if (candidate.getName().compareTo("horizontal") == 0) {
        divW = skip;
        divH = 1;
    } else if (candidate.getName().compareTo("vertical") == 0) {
        divW = 1;
        divH = skip;
    } else {
        divW = divH = skip;
    }
    ImageBase src = ConvolutionTestHelper.createImage(paramTypes[1], width, height);
    GImageMiscOps.fillUniform(src, rand, 0, 130);
    ImageBase dst = ConvolutionTestHelper.createImage(paramTypes[2], width / divW, height / divH);
    Object[][] ret = new Object[1][paramTypes.length];
    ret[0][0] = kernel;
    ret[0][1] = src;
    ret[0][2] = dst;
    ret[0][3] = skip;
    if (paramTypes.length == 5) {
        ret[0][4] = 11;
    }
    return ret;
}
Also used : ImageBase(boofcv.struct.image.ImageBase)

Example 49 with ImageBase

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

the class CompareToStandardConvolveDownNormalized method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    Class<?>[] paramTypes = candidate.getParameterTypes();
    Object kernel = FactoryKernelGaussian.gaussian((Class) paramTypes[0], -1, kernelRadius);
    int divW, divH;
    if (candidate.getName().compareTo("horizontal") == 0) {
        divW = skip;
        divH = 1;
    } else if (candidate.getName().compareTo("vertical") == 0) {
        divW = 1;
        divH = skip;
    } else {
        divW = divH = skip;
    }
    ImageBase src = ConvolutionTestHelper.createImage(paramTypes[1], width, height);
    GImageMiscOps.fillUniform(src, rand, 1, 10);
    ImageBase dst = ConvolutionTestHelper.createImage(paramTypes[2], width / divW, height / divH);
    Object[][] ret = new Object[1][paramTypes.length];
    ret[0][0] = kernel;
    ret[0][1] = src;
    ret[0][2] = dst;
    ret[0][3] = skip;
    if (paramTypes.length == 5) {
        ret[0][4] = 11;
    }
    return ret;
}
Also used : ImageBase(boofcv.struct.image.ImageBase)

Example 50 with ImageBase

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

the class TestConvolveImage method createInputParam.

@Override
protected Object[][] createInputParam(Method candidate, Method validation) {
    Class<?>[] paramTypes = candidate.getParameterTypes();
    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[1][paramTypes.length];
    ret[0][0] = createKernel(paramTypes[0], kernelWidth, kernelOffset);
    ret[0][1] = src;
    ret[0][2] = dst;
    ret[0][3] = FactoryImageBorder.wrap(BorderType.EXTENDED, src);
    return ret;
}
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