use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestImageDistortBasic_SB method applyRenderAll_true.
@Test
public void applyRenderAll_true() {
Helper alg = new Helper(interp);
alg.setRenderAll(true);
offX = offY = 0;
alg.reset();
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(150, alg.getTotal());
offX = offY = 0.1f;
alg.reset();
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(150, alg.getTotal());
offX = offY = -0.1f;
alg.reset();
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(150, alg.getTotal());
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestImageDistortBasic_SB method applyRenderAll_False.
@Test
public void applyRenderAll_False() {
Helper alg = new Helper(interp);
alg.setRenderAll(false);
offX = offY = 0;
alg.reset();
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(150, alg.getTotal());
offX = offY = 0.1f;
alg.reset();
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(9 * 14, alg.getTotal());
offX = offY = -0.1f;
alg.reset();
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(9 * 14, alg.getTotal());
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestImageDistortCache_SB method apply_setRenderAll.
@Test
public void apply_setRenderAll() {
Helper alg = new Helper(interp);
offX = offY = 0;
alg.reset();
alg.setRenderAll(true);
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(150, alg.getTotal());
offX = offY = 0.1f;
alg.reset();
alg.setRenderAll(false);
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(9 * 14, alg.getTotal());
offX = offY = -0.1f;
alg.reset();
alg.setRenderAll(false);
alg.setModel(tran);
alg.apply(new GrayF32(10, 15), new GrayF32(10, 15));
assertEquals(9 * 14, alg.getTotal());
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestAnyImageDerivative method test.
@Test
public void test() {
ImageGradient<GrayF32, GrayF32> g = FactoryDerivative.three(GrayF32.class, null);
GrayF32 derivX = new GrayF32(width, height);
GrayF32 derivY = new GrayF32(width, height);
GrayF32 derivXX = new GrayF32(width, height);
GrayF32 derivYY = new GrayF32(width, height);
GrayF32 derivXY = new GrayF32(width, height);
GrayF32 derivYX = new GrayF32(width, height);
GrayF32 derivYYX = new GrayF32(width, height);
GrayF32 derivYYY = new GrayF32(width, height);
GImageMiscOps.fillUniform(original, rand, 0, 40);
g.process(original, derivX, derivY);
g.process(derivX, derivXX, derivXY);
g.process(derivY, derivYX, derivYY);
g.process(derivYY, derivYYX, derivYYY);
Kernel1D_F32 kernelX = (Kernel1D_F32) GradientThree.getKernelX(false);
AnyImageDerivative<GrayF32, GrayF32> alg = new AnyImageDerivative<>(kernelX, GrayF32.class, GrayF32.class);
alg.setInput(original);
// do one out of order which will force it to meet all the dependencies
BoofTesting.assertEquals(derivYYY, alg.getDerivative(false, false, false), 1e-4);
BoofTesting.assertEquals(derivX, alg.getDerivative(true), 1e-4);
BoofTesting.assertEquals(derivY, alg.getDerivative(false), 1e-4);
BoofTesting.assertEquals(derivXX, alg.getDerivative(true, true), 1e-4);
BoofTesting.assertEquals(derivXY, alg.getDerivative(true, false), 1e-4);
BoofTesting.assertEquals(derivYY, alg.getDerivative(false, false), 1e-4);
BoofTesting.assertEquals(derivYYX, alg.getDerivative(false, false, true), 1e-4);
}
use of boofcv.struct.image.GrayF32 in project BoofCV by lessthanoptimal.
the class TestAnyImageDerivative method changeInputImageSize.
/**
* See if changing the input image size causes an exception to be thrown.
*/
@Test
public void changeInputImageSize() {
Kernel1D_F32 kernelX = (Kernel1D_F32) GradientThree.getKernelX(false);
AnyImageDerivative<GrayF32, GrayF32> alg = new AnyImageDerivative<>(kernelX, GrayF32.class, GrayF32.class);
alg.setInput(original);
alg.getDerivative(true);
GrayF32 smaller = new GrayF32(width - 5, height - 5);
GImageMiscOps.fillUniform(smaller, rand, 0, 40);
// assume that if it can't handle variable sized inputs then an exception is thrown
alg.setInput(smaller);
alg.getDerivative(true);
}
Aggregations