use of boofcv.core.image.border.ImageBorder1D_S32 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.core.image.border.ImageBorder1D_S32 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);
}
use of boofcv.core.image.border.ImageBorder1D_S32 in project BoofCV by lessthanoptimal.
the class TestImplShiTomasiCornerWeighted_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.core.image.border.ImageBorder1D_S32 in project BoofCV by lessthanoptimal.
the class TestFactoryConvolve method convolve1D_I32.
@Test
public void convolve1D_I32() {
Kernel1D_S32 kernel = FactoryKernel.random1D_I32(kernelWidth, radius, 1, 6, rand);
ConvolveInterface conv;
GrayU8 input = new GrayU8(width, height);
GrayS16 found = new GrayS16(width, height);
GrayS16 expected = new GrayS16(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 5);
// CHECK NO BORDER
conv = FactoryConvolve.convolve(kernel, input.imageType, found.imageType, BorderType.SKIP, true);
conv.process(input, found);
ConvolveImageNoBorder.horizontal(kernel, input, expected);
BoofTesting.assertEquals(expected, found, 0);
// CHECK EXTENDED
conv = FactoryConvolve.convolve(kernel, input.imageType, found.imageType, BorderType.EXTENDED, true);
conv.process(input, found);
ConvolveImage.horizontal(kernel, input, expected, new ImageBorder1D_S32(BorderIndex1D_Extend.class));
BoofTesting.assertEquals(expected, found, 0);
// CHECK NORMALIZED
GrayU8 found8 = new GrayU8(width, height);
GrayU8 expected8 = new GrayU8(width, height);
conv = FactoryConvolve.convolve(kernel, input.imageType, ImageType.single(GrayI8.class), BorderType.NORMALIZED, true);
conv.process(input, found8);
ConvolveImageNormalized.horizontal(kernel, input, expected8);
BoofTesting.assertEquals(expected8, found8, 0);
}
use of boofcv.core.image.border.ImageBorder1D_S32 in project BoofCV by lessthanoptimal.
the class TestFactoryConvolve method convolve2D_I32.
@Test
public void convolve2D_I32() {
Kernel2D_S32 kernel = FactoryKernel.random2D_I32(kernelWidth, radius, 1, 6, rand);
ConvolveInterface conv;
GrayU8 input = new GrayU8(width, height);
GrayS16 found = new GrayS16(width, height);
GrayS16 expected = new GrayS16(width, height);
ImageMiscOps.fillUniform(input, rand, 0, 5);
// CHECK NO BORDER
conv = FactoryConvolve.convolve(kernel, GrayU8.class, GrayI16.class, BorderType.SKIP);
conv.process(input, found);
ConvolveImageNoBorder.convolve(kernel, input, expected);
BoofTesting.assertEquals(expected, found, 0);
// CHECK EXTENDED
conv = FactoryConvolve.convolve(kernel, GrayU8.class, GrayI16.class, BorderType.EXTENDED);
conv.process(input, found);
ConvolveImage.convolve(kernel, input, expected, new ImageBorder1D_S32(BorderIndex1D_Extend.class));
BoofTesting.assertEquals(expected, found, 0);
// CHECK NORMALIZED
GrayU8 found8 = new GrayU8(width, height);
GrayU8 expected8 = new GrayU8(width, height);
conv = FactoryConvolve.convolve(kernel, GrayU8.class, GrayU8.class, BorderType.NORMALIZED);
conv.process(input, found8);
ConvolveImageNormalized.convolve(kernel, input, expected8);
BoofTesting.assertEquals(expected8, found8, 0);
}
Aggregations