use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestGradientMultiToSingleBand_Reflection method expected.
/**
* Pass in a simple method and see if it is invoked correctly
*/
@Test
public void expected() {
try {
Method m = getClass().getMethod("helper", Planar.class, Planar.class, GrayF32.class, GrayF32.class);
GradientMultiToSingleBand_Reflection alg = new GradientMultiToSingleBand_Reflection(m, ImageType.pl(3, GrayF32.class), GrayF32.class);
assertTrue(alg.getInputType().getFamily() == ImageType.Family.PLANAR);
assertTrue(alg.getOutputType() == GrayF32.class);
Planar<GrayF32> inX = new Planar<>(GrayF32.class, 10, 12, 3);
Planar<GrayF32> inY = new Planar<>(GrayF32.class, 10, 12, 3);
GrayF32 outX = new GrayF32(10, 12);
GrayF32 outY = new GrayF32(10, 12);
alg.process(inX, inY, outX, outY);
assertEquals(2, outX.data[5], 1e-4f);
assertEquals(3, outY.data[5], 1e-4f);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestImageGradient_Reflection method testNoException.
/**
* See if it throws an exception or not
*/
@Test
public void testNoException() throws NoSuchMethodException {
GrayF32 input = new GrayF32(width, height);
GrayF32 derivX = new GrayF32(width, height);
GrayF32 derivY = new GrayF32(width, height);
Method m = GradientSobel.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class);
ImageGradient_Reflection<GrayF32, GrayF32> alg = new ImageGradient_Reflection<>(m);
alg.process(input, derivX, derivY);
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestImageHessianDirect_Reflection method testNoException.
/**
* See if it throws an exception or not
*/
@Test
public void testNoException() throws NoSuchMethodException {
GrayF32 input = new GrayF32(width, height);
GrayF32 derivXX = new GrayF32(width, height);
GrayF32 derivYY = new GrayF32(width, height);
GrayF32 derivXY = new GrayF32(width, height);
Method m = HessianSobel.class.getMethod("process", GrayF32.class, GrayF32.class, GrayF32.class, GrayF32.class, ImageBorder_F32.class);
ImageHessianDirect_Reflection<GrayF32, GrayF32> alg = new ImageHessianDirect_Reflection<>(m);
alg.process(input, derivXX, derivYY, derivXY);
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestUtilDenoiseWavelet method universalThreshold.
@Test
public void universalThreshold() {
GrayF32 image = new GrayF32(width, height);
double sigma = 12;
double found = UtilDenoiseWavelet.universalThreshold(image, sigma);
double expected = sigma * Math.sqrt(2.0 * Math.log(height));
assertEquals(expected, found, 1e-4);
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestInterpolatePixel_PL_using_SB method compareToIndividual.
@Test
public void compareToIndividual() {
GrayF32 image0 = new GrayF32(width, height);
GrayF32 image1 = new GrayF32(width, height);
ImageMiscOps.fillUniform(image0, rand, 0, 100);
ImageMiscOps.fillUniform(image1, rand, 0, 100);
InterpolatePixelS<GrayF32> interpA = FactoryInterpolation.bilinearPixelS(GrayF32.class, BorderType.EXTENDED);
InterpolatePixelS<GrayF32> interpB = FactoryInterpolation.bilinearPixelS(GrayF32.class, BorderType.EXTENDED);
InterpolatePixelMB<Planar<GrayF32>> alg = new InterpolatePixel_PL_using_SB<>(interpB);
Planar<GrayF32> mb = new Planar<>(GrayF32.class, width, height, 2);
mb.bands[0] = image0;
mb.bands[1] = image1;
alg.setImage(mb);
float[] vals = new float[2];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float xx = (rand.nextFloat() - 0.5f) + x;
float yy = (rand.nextFloat() - 0.5f) + y;
if (xx < 0)
xx = 0;
else if (xx > width - 1)
xx = width - 1;
if (yy < 0)
yy = 0;
else if (yy > height - 1)
yy = height - 1;
alg.get(xx, yy, vals);
interpA.setImage(image0);
float expected0 = interpA.get(xx, yy);
interpA.setImage(image1);
float expected1 = interpA.get(xx, yy);
assertEquals(expected0, vals[0], 1e-4);
assertEquals(expected1, vals[1], 1e-4);
}
}
}
Aggregations