use of boofcv.core.image.border.ImageBorder1D_S32 in project BoofCV by lessthanoptimal.
the class StandardGradientChecks method testSecondDerivative.
/**
* The XY and YX second derivatives should be indential
*/
private void testSecondDerivative(Method m1, Method m2) {
Class[] params = m1.getParameterTypes();
ImageGray input = GeneralizedImageOps.createSingleBand(params[0], width, height);
ImageGray derivX = GeneralizedImageOps.createSingleBand(params[1], width, height);
ImageGray derivY = GeneralizedImageOps.createSingleBand(params[2], width, height);
ImageGray derivXX = GeneralizedImageOps.createSingleBand(params[1], width, height);
ImageGray derivYY = GeneralizedImageOps.createSingleBand(params[2], width, height);
ImageGray derivXY = GeneralizedImageOps.createSingleBand(params[1], width, height);
ImageGray derivYX = GeneralizedImageOps.createSingleBand(params[1], width, height);
GImageMiscOps.fillUniform(input, rand, 0, 40);
Object border;
if (params[3] == ImageBorder_F32.class) {
border = new ImageBorder1D_F32(BorderIndex1D_Wrap.class);
} else {
border = new ImageBorder1D_S32(BorderIndex1D_Wrap.class);
}
try {
m1.invoke(null, input, derivX, derivY, border);
m2.invoke(null, derivX, derivXX, derivXY, border);
m2.invoke(null, derivY, derivYX, derivYY, border);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
// BoofTesting.printDiff(derivXY,derivYX);
BoofTesting.assertEquals(derivXY, derivYX, 1e-3f);
}
use of boofcv.core.image.border.ImageBorder1D_S32 in project BoofCV by lessthanoptimal.
the class TestImplShiTomasiCorner_F32 method compareToNaive.
/**
* Sees if the integer version and this version produce the same results.
* <p/>
* Creates a random image and looks for corners in it. Sees if the naive
* and fast algorithm produce exactly the same results.
*/
@Test
public void compareToNaive() {
GrayU8 img = new GrayU8(width, height);
ImageMiscOps.fillUniform(img, new Random(0xfeed), 0, 100);
GrayS16 derivX_I = new GrayS16(img.getWidth(), img.getHeight());
GrayS16 derivY_I = new GrayS16(img.getWidth(), img.getHeight());
GradientSobel.process(img, derivX_I, derivY_I, new ImageBorder1D_S32(BorderIndex1D_Extend.class));
GrayF32 derivX_F = ConvertImage.convert(derivX_I, (GrayF32) null);
GrayF32 derivY_F = ConvertImage.convert(derivY_I, (GrayF32) null);
BoofTesting.checkSubImage(this, "compareToNaive", true, derivX_F, derivY_F);
}
Aggregations