use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestHessianThree method compareToConvolve_F32.
@Test
void compareToConvolve_F32() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(HessianThree.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class));
validator.setKernel(0, HessianThree.kernelXXYY_F32, true);
validator.setKernel(1, HessianThree.kernelXXYY_F32, false);
validator.setKernel(2, HessianThree.kernelCross_F32);
GrayF32 input = new GrayF32(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayF32 derivXX = new GrayF32(width, height);
GrayF32 derivYY = new GrayF32(width, height);
GrayF32 derivXY = new GrayF32(width, height);
validator.compare(input, derivXX, derivYY, derivXY);
}
use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestHessianFromGradient method hessianPrewitt_F32.
@Test
void hessianPrewitt_F32() throws NoSuchMethodException {
CompareHessianToConvolution validator = new CompareHessianToConvolution();
validator.setTarget(HessianFromGradient.class.getMethod("hessianPrewitt", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class));
validator.setKernel(0, GradientPrewitt.kernelDerivX_F32);
validator.setKernel(1, GradientPrewitt.kernelDerivY_F32);
GrayF32 derivX = new GrayF32(width, height);
GrayF32 derivY = new GrayF32(width, height);
ImageMiscOps.fillUniform(derivX, rand, -10, 10);
ImageMiscOps.fillUniform(derivY, rand, -10, 10);
GrayF32 derivXX = new GrayF32(width, height);
GrayF32 derivYY = new GrayF32(width, height);
GrayF32 derivXY = new GrayF32(width, height);
validator.compare(derivX, derivY, derivXX, derivYY, derivXY);
}
use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestHessianFromGradient method hessianThree_F32.
@Test
void hessianThree_F32() throws NoSuchMethodException {
CompareHessianToConvolution validator = new CompareHessianToConvolution();
validator.setTarget(HessianFromGradient.class.getMethod("hessianThree", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class));
validator.setKernel(0, GradientThree.kernelDeriv_F32, true);
validator.setKernel(1, GradientThree.kernelDeriv_F32, false);
GrayF32 derivX = new GrayF32(width, height);
GrayF32 derivY = new GrayF32(width, height);
ImageMiscOps.fillUniform(derivX, rand, -10, 10);
ImageMiscOps.fillUniform(derivY, rand, -10, 10);
GrayF32 derivXX = new GrayF32(width, height);
GrayF32 derivYY = new GrayF32(width, height);
GrayF32 derivXY = new GrayF32(width, height);
validator.compare(derivX, derivY, derivXX, derivYY, derivXY);
}
use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestHessianThreeDeterminant_Border method hessianDetFromConv_F32_F32.
public static GrayF32 hessianDetFromConv_F32_F32(GrayF32 img) {
ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorder.single(BorderType.EXTENDED, GrayF32.class);
GrayF32 Lxx = new GrayF32(img.width, img.height);
GrayF32 Lyy = new GrayF32(img.width, img.height);
GrayF32 Lxy = new GrayF32(img.width, img.height);
ConvolveImage.horizontal(HessianThree.kernelXXYY_F32, img, Lxx, border);
ConvolveImage.vertical(HessianThree.kernelXXYY_F32, img, Lyy, border);
ConvolveImage.convolve(HessianThree.kernelCross_F32, img, Lxy, border);
GrayF32 expected = new GrayF32(img.width, img.height);
for (int y = 0; y < img.height; y++) {
for (int x = 0; x < img.width; x++) {
expected.data[expected.getIndex(x, y)] = 4 * (Lxx.get(x, y) * Lyy.get(x, y) - Lxy.get(x, y) * Lxy.get(x, y));
}
}
return expected;
}
use of boofcv.struct.border.ImageBorder_F32 in project BoofCV by lessthanoptimal.
the class TestHessianThreeDeterminant_Border method process_F32.
public void process_F32(GrayF32 img, GrayF32 deriv) {
ImageBorder_F32 border = (ImageBorder_F32) FactoryImageBorder.single(BorderType.EXTENDED, GrayF32.class);
HessianThreeDeterminant_Border.process(img, deriv, border);
GrayF32 expected = hessianDetFromConv_F32_F32(img);
BoofTesting.assertEqualsBorder(expected, deriv, 1e-4, 2, 2);
}
Aggregations