use of boofcv.core.image.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method kernelHaarX.
@Test
public void kernelHaarX() {
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 r = 1; r < 5; r++) {
IntegralKernel kernelI = DerivativeIntegralImage.kernelHaarX(r, null);
Kernel2D_F32 kernel = createHaarX(r);
ConvolveImage.convolve(kernel, orig, expected, border);
IntegralImageOps.convolve(integral, kernelI, found);
BoofTesting.assertEquals(expected, found, 1e-2);
}
}
use of boofcv.core.image.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method kernelDerivYY.
@Test
public void kernelDerivYY() {
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.kernelDerivYY(size, null);
Kernel2D_F32 kernel = createDerivXX(size);
kernel = KernelMath.transpose(kernel);
ConvolveImage.convolve(kernel, orig, expected, border);
IntegralImageOps.convolve(integral, kernelI, found);
BoofTesting.assertEquals(expected, found, 1e-2);
}
}
use of boofcv.core.image.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestDerivativeIntegralImage method kernelDerivX.
@Test
public void kernelDerivX() {
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 r = 1; r < 5; r++) {
IntegralKernel kernelI = DerivativeIntegralImage.kernelDerivX(r, null);
Kernel2D_F32 kernel = createDerivX(r);
ConvolveImage.convolve(kernel, orig, expected, border);
IntegralImageOps.convolve(integral, kernelI, found);
BoofTesting.assertEquals(expected, found, 1e-2);
}
}
use of boofcv.core.image.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class ImplBilinearPixel_F32 method get_border.
public float get_border(float x, float y) {
float xf = (float) Math.floor(x);
float yf = (float) Math.floor(y);
int xt = (int) xf;
int yt = (int) yf;
float ax = x - xf;
float ay = y - yf;
ImageBorder_F32 border = (ImageBorder_F32) this.border;
// (x,y)
float val = (1.0f - ax) * (1.0f - ay) * border.get(xt, yt);
// (x+1,y)
val += ax * (1.0f - ay) * border.get(xt + 1, yt);
// (x+1,y)
;
// (x+1,y+1)
val += ax * ay * border.get(xt + 1, yt + 1);
// (x+1,y+1)
;
// (x,y+1)
val += (1.0f - ax) * ay * border.get(xt, yt + 1);
// (x,y+1)
;
return val;
}
use of boofcv.core.image.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestGradientPrewitt method compareToConvolve_F32.
@Test
public void compareToConvolve_F32() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(GradientPrewitt.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class));
validator.setKernel(0, GradientPrewitt.kernelDerivX_F32);
validator.setKernel(1, GradientPrewitt.kernelDerivY_F32);
GrayF32 input = new GrayF32(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayF32 derivX = new GrayF32(width, height);
GrayF32 derivY = new GrayF32(width, height);
validator.compare(input, derivX, derivY);
}
Aggregations