use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestImageLineIntegral method inside_nonZero.
/**
* See if it calculates the integral correctly inside a single pixel
*/
@Test
public void inside_nonZero() {
GrayU8 img = new GrayU8(10, 15);
ImageMiscOps.fill(img, 255);
img.set(6, 6, 100);
alg.setImage(FactoryGImageGray.wrap(img));
// entirely inside
double r = Math.sqrt(0.1 * 0.1 + 0.2 * 0.2);
checkSolution(6.1, 6.2, 6.2, 6.4, r * 100);
checkSolution(6.2, 6.1, 6.4, 6.2, r * 100);
// one entire diagonal
checkSolution(6, 6, 7, 7, sqrt(2) * 100);
checkSolution(6, 7, 7, 6, sqrt(2) * 100);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestImageLineIntegral method nearBorder_nonZero.
/**
* See if it handles borders correctly with both slopes are not zero
*/
@Test
public void nearBorder_nonZero() {
GrayU8 img = new GrayU8(2, 2);
img.set(0, 0, 100);
img.set(0, 1, 200);
img.set(1, 0, 140);
img.set(1, 1, 150);
alg.setImage(FactoryGImageGray.wrap(img));
checkSolution(0, 0, 2, 2, sqrt(2) * (100 + 150));
checkSolution(2, 0, 0, 2, sqrt(2) * (200 + 140));
// two squares horizontal and vertical
double r = Math.sqrt(1 + 4) / 2;
checkSolution(0, 0, 2, 1, r * (100 + 140));
checkSolution(0, 0, 1, 2, r * (100 + 200));
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestImageLineIntegral method zeroLengthLine.
/**
* The same two points are passed in for the end points
*/
@Test
public void zeroLengthLine() {
GrayU8 img = new GrayU8(10, 15);
img.set(6, 6, 100);
alg.setImage(FactoryGImageGray.wrap(img));
checkSolution(6, 6, 6, 6, 0);
checkSolution(6.1, 6.1, 6.1, 6.1, 0);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestImageLineIntegral method inside_SlopeZero.
/**
* Tests an integral inside a single pixel where x or y slope is zero
*/
@Test
public void inside_SlopeZero() {
GrayU8 img = new GrayU8(10, 15);
img.set(6, 6, 100);
alg.setImage(FactoryGImageGray.wrap(img));
checkSolution(6.5, 6, 6.5, 7, 100);
checkSolution(6.5, 6, 6.5, 6.9, 0.9 * 100);
checkSolution(6.5, 6.1, 6.5, 7.0, 0.9 * 100);
checkSolution(6, 6.5, 7, 6.5, 100);
checkSolution(6, 6.5, 6.9, 6.5, 0.9 * 100);
checkSolution(6.1, 6.5, 7, 6.5, 0.9 * 100);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestGradientTwo1_Standard method compareToConvolve_I8.
@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(GradientTwo1_Standard.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class));
validator.setKernel(0, GradientTwo1.kernelDeriv_I32, true);
validator.setKernel(1, GradientTwo1.kernelDeriv_I32, false);
GrayU8 input = new GrayU8(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayS16 derivX = new GrayS16(width, height);
GrayS16 derivY = new GrayS16(width, height);
validator.compare(false, input, derivX, derivY);
}
Aggregations