use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.
the class SteerableKernel_F32 method setBasis.
@Override
public void setBasis(SteerableCoefficients coef, Kernel2D... basis) {
this.coef = coef;
this.basis = basis;
int width = basis[0].width;
output = new Kernel2D_F32(width);
}
use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method createDerivX.
private Kernel2D_F32 createDerivX(int r) {
int size = r * 2 + 1;
Kernel2D_F32 ret = new Kernel2D_F32(size);
for (int y = 0; y < size; y++) {
for (int x = 0; x < r; x++) {
ret.set(x, y, -1);
ret.set(x + r + 1, y, 1);
}
}
return ret;
}
use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method kernelDerivXX.
@Test
public void kernelDerivXX() {
GrayF32 orig = new GrayF32(width, height);
GrayF32 integral = new GrayF32(width, height);
ImageMiscOps.fillUniform(orig, rand, 0, 20);
GrayF32 expected = new GrayF32(width, height);
GrayF32 found = new GrayF32(width, height);
IntegralImageOps.transform(orig, integral);
ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorderAlgs.value(orig, 0);
for (int i = 1; i <= 5; i += 2) {
int size = i * 3;
IntegralKernel kernelI = DerivativeIntegralImage.kernelDerivXX(size, null);
Kernel2D_F32 kernel = createDerivXX(size);
ConvolveImage.convolve(kernel, orig, expected, border);
IntegralImageOps.convolve(integral, kernelI, found);
BoofTesting.assertEquals(expected, found, 1e-2);
}
}
use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method createDerivXY.
private Kernel2D_F32 createDerivXY(int size) {
int block = size / 3;
int border = (size - 2 * block - 1) / 2;
int w = block * 3;
Kernel2D_F32 ret = new Kernel2D_F32(w);
for (int y = border; y < border + block; y++) {
for (int x = border; x < block + border; x++) {
ret.set(x, y, 1);
ret.set(x + block + 1, y, -1);
}
}
for (int y = border + block + 1; y < size - border; y++) {
for (int x = border; x < block + border; x++) {
ret.set(x, y, -1);
ret.set(x + block + 1, y, 1);
}
}
return ret;
}
use of boofcv.struct.convolve.Kernel2D_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method derivYY.
@Test
public void derivYY() {
GrayF32 orig = new GrayF32(width, height);
GrayF32 integral = new GrayF32(width, height);
ImageMiscOps.fillUniform(orig, rand, 0, 20);
GrayF32 expected = new GrayF32(width, height);
GrayF32 found = new GrayF32(width, height);
IntegralImageOps.transform(orig, integral);
for (int i = 1; i <= 5; i += 2) {
int size = i * 3;
Kernel2D_F32 kernel = createDerivXX(size);
kernel = KernelMath.transpose(kernel);
ConvolveImageNoBorder.convolve(kernel, orig, expected);
DerivativeIntegralImage.derivYY(integral, found, size);
int r = size / 2;
GrayF32 a = expected.subimage(r + 1, r + 1, expected.width - r, expected.height - r, null);
GrayF32 b = found.subimage(r + 1, r + 1, found.width - r, found.height - r, null);
BoofTesting.assertEquals(a, b, 1e-2);
}
}
Aggregations