use of boofcv.alg.interpolate.InterpolatePixel in project BoofCV by lessthanoptimal.
the class TestFDistort method setBorderChange.
/**
* Makes sure that border recycling doesn't mess things up
*/
@Test
public void setBorderChange() {
ImageMiscOps.fillUniform(input, rand, 0, 200);
GrayU8 found = new GrayU8(width / 2, height / 2);
GrayU8 expected = new GrayU8(width / 2, height / 2);
FDistort alg = new FDistort();
alg.init(input, found).scaleExt().apply();
ImageDistort distorter = alg.distorter;
InterpolatePixel interp = alg.interp;
;
PixelTransform2_F32 outputToInput = alg.outputToInput;
// Set it to the default border, nothing should change
expected.setTo(found);
alg.border(BorderType.EXTENDED).apply();
assertTrue(distorter == alg.distorter);
assertTrue(interp == alg.interp);
assertTrue(outputToInput == alg.outputToInput);
BoofTesting.assertEquals(expected, found, 1e-4);
// change border now a fixed value
alg.border(10).apply();
new FDistort(input, expected).scale().border(10).apply();
BoofTesting.assertEquals(expected, found, 1e-4);
// change value
alg.border(1).apply();
new FDistort(input, expected).scale().border(1).apply();
BoofTesting.assertEquals(expected, found, 1e-4);
}
use of boofcv.alg.interpolate.InterpolatePixel in project BoofCV by lessthanoptimal.
the class TestFDistort method setRefs.
/**
* Makes sure that setRefs doesn't cause it to blow up
*/
@Test
public void setRefs() {
ImageMiscOps.fillUniform(input, rand, 0, 200);
FDistort alg = new FDistort();
alg.setRefs(input, output).interp(InterpolationType.BILINEAR).scaleExt().apply();
ImageDistort distorter = alg.distorter;
InterpolatePixel interp = alg.interp;
;
PixelTransform2_F32 outputToInput = alg.outputToInput;
// a new image shouldn't cause new memory to be declared bad stuff to happen
GrayU8 found = new GrayU8(width / 2, height / 2);
GrayU8 expected = new GrayU8(width / 2, height / 2);
alg.setRefs(input, found).scale().apply();
assertTrue(distorter == alg.distorter);
assertTrue(interp == alg.interp);
assertTrue(outputToInput == alg.outputToInput);
new FDistort(input, expected).scaleExt().apply();
BoofTesting.assertEquals(expected, found, 1e-4);
}
Aggregations