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();
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations