use of boofcv.struct.image.GrayS32 in project BoofCV by lessthanoptimal.
the class TestImplIntegralImageOps method convolve.
public void convolve(Method m) throws InvocationTargetException, IllegalAccessException {
Kernel2D_S32 kernel = new Kernel2D_S32(3, new int[] { 1, 1, 1, 2, 2, 2, 1, 1, 1 });
GrayU8 input = new GrayU8(width, height);
GrayS32 expected = new GrayS32(width, height);
GImageMiscOps.fillUniform(input, rand, 0, 10);
ImageBorder_S32 border = FactoryImageBorderAlgs.value(input, 0);
ConvolveImage.convolve(kernel, input, expected, border);
Class[] paramType = m.getParameterTypes();
Class inputType = paramType[0];
Class outputType = paramType[2];
ImageGray inputII = GeneralizedImageOps.createSingleBand(inputType, width, height);
ImageGray integral = GeneralizedImageOps.createSingleBand(outputType, width, height);
ImageGray expectedII = GeneralizedImageOps.createSingleBand(outputType, width, height);
ImageGray found = GeneralizedImageOps.createSingleBand(outputType, width, height);
GConvertImage.convert(input, inputII);
GConvertImage.convert(expected, expectedII);
GIntegralImageOps.transform(inputII, integral);
IntegralKernel kernelII = new IntegralKernel(2);
kernelII.blocks[0] = new ImageRectangle(-2, -2, 1, 1);
kernelII.blocks[1] = new ImageRectangle(-2, -1, 1, 0);
kernelII.scales = new int[] { 1, 1 };
m.invoke(null, integral, kernelII, found);
BoofTesting.assertEqualsRelative(expected, found, 1e-4f);
}
use of boofcv.struct.image.GrayS32 in project BoofCV by lessthanoptimal.
the class TestImplIntegralImageOps method convolveBorder.
public void convolveBorder(Method m) throws InvocationTargetException, IllegalAccessException {
Kernel2D_S32 kernel = new Kernel2D_S32(3, new int[] { 1, 1, 1, 2, 2, 2, 1, 1, 1 });
GrayU8 input = new GrayU8(width, height);
GrayS32 expected = new GrayS32(width, height);
GImageMiscOps.fillUniform(input, rand, 0, 10);
ImageBorder_S32 border = FactoryImageBorderAlgs.value(input, 0);
ConvolveImage.convolve(kernel, input, expected, border);
Class[] paramType = m.getParameterTypes();
Class inputType = paramType[0];
Class outputType = paramType[2];
ImageGray inputII = GeneralizedImageOps.createSingleBand(inputType, width, height);
ImageGray integral = GeneralizedImageOps.createSingleBand(outputType, width, height);
ImageGray expectedII = GeneralizedImageOps.createSingleBand(outputType, width, height);
ImageGray found = GeneralizedImageOps.createSingleBand(outputType, width, height);
GConvertImage.convert(input, inputII);
GConvertImage.convert(expected, expectedII);
GIntegralImageOps.transform(inputII, integral);
IntegralKernel kernelII = new IntegralKernel(2);
kernelII.blocks[0] = new ImageRectangle(-2, -2, 1, 1);
kernelII.blocks[1] = new ImageRectangle(-2, -1, 1, 0);
kernelII.scales = new int[] { 1, 1 };
m.invoke(null, integral, kernelII, found, 4, 5);
BoofTesting.assertEqualsBorder(expected, found, 1e-4f, 4, 5);
}
use of boofcv.struct.image.GrayS32 in project BoofCV by lessthanoptimal.
the class TestImplWaveletTransformNaive method testEncodeDecode_I32.
private void testEncodeDecode_I32(int widthOrig, int heightOrig, int widthOut, int heightOut) {
GrayU8 orig = new GrayU8(widthOrig, heightOrig);
ImageMiscOps.fillUniform(orig, rand, 0, 10);
GrayS32 transformed = new GrayS32(widthOut, heightOut);
GrayU8 reconstructed = new GrayU8(widthOrig, heightOrig);
BoofTesting.checkSubImage(this, "checkTransforms_I", true, orig, transformed, reconstructed);
}
use of boofcv.struct.image.GrayS32 in project BoofCV by lessthanoptimal.
the class TestImplIntegralImageFeatureIntensity method inner_S32.
/**
* Compares the inner() function against the output from the naive function.
*/
@Test
public void inner_S32() {
GrayS32 original = new GrayS32(width, height);
GrayS32 integral = new GrayS32(width, height);
GrayF32 found = new GrayF32(width, height);
GrayF32 expected = new GrayF32(width, height);
GImageMiscOps.fillUniform(original, rand, 0, 50);
IntegralImageOps.transform(original, integral);
int size = 9;
int r = size / 2 + 1;
r++;
for (int skip = 1; skip <= 4; skip++) {
found.reshape(width / skip, height / skip);
expected.reshape(width / skip, height / skip);
ImplIntegralImageFeatureIntensity.hessianNaive(integral, skip, size, expected);
ImplIntegralImageFeatureIntensity.hessianInner(integral, skip, size, found);
int w = found.width;
int h = found.height;
GrayF32 f = found.subimage(r + 1, r + 1, w - r, h - r, null);
GrayF32 e = expected.subimage(r + 1, r + 1, w - r, h - r, null);
BoofTesting.assertEquals(e, f, 1e-4f);
}
}
use of boofcv.struct.image.GrayS32 in project BoofCV by lessthanoptimal.
the class TestIntegralImageFeatureIntensity method hessian_S32.
/**
* Compares hessian intensity against a naive implementation
*/
@Test
public void hessian_S32() {
GrayS32 original = new GrayS32(width, height);
GrayS32 integral = new GrayS32(width, height);
GrayF32 found = new GrayF32(width, height);
GrayF32 expected = new GrayF32(width, height);
GImageMiscOps.fillUniform(original, rand, 0, 50);
IntegralImageOps.transform(original, integral);
int size = 9;
for (int skip = 1; skip <= 4; skip++) {
found.reshape(width / skip, height / skip);
expected.reshape(width / skip, height / skip);
ImplIntegralImageFeatureIntensity.hessianNaive(integral, skip, size, expected);
IntegralImageFeatureIntensity.hessian(integral, skip, size, found);
BoofTesting.assertEquals(expected, found, 1e-4f);
}
}
Aggregations