use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestHessianSobel_Shared method compareToConvolve_I8.
@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(HessianSobel_Shared.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.class));
validator.setKernel(0, HessianSobel.kernelXX_I32);
validator.setKernel(1, HessianSobel.kernelYY_I32);
validator.setKernel(2, HessianSobel.kernelXY_I32);
GrayU8 input = new GrayU8(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayS16 derivXX = new GrayS16(width, height);
GrayS16 derivYY = new GrayS16(width, height);
GrayS16 derivXY = new GrayS16(width, height);
validator.compare(false, input, derivXX, derivYY, derivXY);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestHessianThree_Standard method compareToConvolve_I8.
@Test
public void compareToConvolve_I8() throws NoSuchMethodException {
CompareDerivativeToConvolution validator = new CompareDerivativeToConvolution();
validator.setTarget(HessianThree_Standard.class.getMethod("process", GrayU8.class, GrayS16.class, GrayS16.class, GrayS16.class));
validator.setKernel(0, HessianThree.kernelXXYY_I32, true);
validator.setKernel(1, HessianThree.kernelXXYY_I32, false);
validator.setKernel(2, HessianThree.kernelCross_I32);
GrayU8 input = new GrayU8(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 10);
GrayS16 derivXX = new GrayS16(width, height);
GrayS16 derivYY = new GrayS16(width, height);
GrayS16 derivXY = new GrayS16(width, height);
validator.compare(false, input, derivXX, derivYY, derivXY);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestGradientReduceToSingle method maxf_plfu8_u8.
@Test
public void maxf_plfu8_u8() {
Planar<GrayU8> inX = new Planar<>(GrayU8.class, width, height, numbands);
Planar<GrayU8> inY = new Planar<>(GrayU8.class, width, height, numbands);
GrayU8 outX = new GrayU8(width, height);
GrayU8 outY = new GrayU8(width, height);
GImageMiscOps.fillUniform(inX, rand, 0, 100);
GImageMiscOps.fillUniform(inY, rand, 0, 100);
GradientReduceToSingle.maxf(inX, inY, outX, outY);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int maxNorm = 0;
int maxValueX = -Integer.MAX_VALUE;
int maxValueY = -Integer.MAX_VALUE;
for (int i = 0; i < numbands; i++) {
int dx = inX.getBand(i).get(x, y);
int dy = inY.getBand(i).get(x, y);
int r = dx * dx + dy * dy;
if (r > maxNorm) {
maxNorm = r;
maxValueX = dx;
maxValueY = dy;
}
}
assertEquals(maxValueX, outX.get(x, y), 1e-4f);
assertEquals(maxValueY, outY.get(x, y), 1e-4f);
}
}
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestImplShiTomasiCorner_S16 method compareToNaive.
/**
* 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 = new GrayS16(img.getWidth(), img.getHeight());
GrayS16 derivY = new GrayS16(img.getWidth(), img.getHeight());
GradientSobel.process(img, derivX, derivY, new ImageBorder1D_S32(BorderIndex1D_Extend.class));
BoofTesting.checkSubImage(this, "compareToNaive", true, derivX, derivY);
}
use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.
the class TestImplShiTomasiCornerWeighted_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