Search in sources :

Example 1 with ImageBorder1D_S32

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);
}
Also used : Random(java.util.Random) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) Test(org.junit.Test)

Example 2 with ImageBorder1D_S32

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);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) Random(java.util.Random) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) Test(org.junit.Test)

Example 3 with ImageBorder1D_S32

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);
}
Also used : Random(java.util.Random) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) Test(org.junit.Test)

Example 4 with ImageBorder1D_S32

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);
}
Also used : Kernel1D_S32(boofcv.struct.convolve.Kernel1D_S32) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) Test(org.junit.Test)

Example 5 with ImageBorder1D_S32

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);
}
Also used : Kernel2D_S32(boofcv.struct.convolve.Kernel2D_S32) ImageBorder1D_S32(boofcv.core.image.border.ImageBorder1D_S32) BorderIndex1D_Extend(boofcv.core.image.border.BorderIndex1D_Extend) Test(org.junit.Test)

Aggregations

ImageBorder1D_S32 (boofcv.core.image.border.ImageBorder1D_S32)7 BorderIndex1D_Extend (boofcv.core.image.border.BorderIndex1D_Extend)6 Test (org.junit.Test)6 GrayS16 (boofcv.struct.image.GrayS16)4 GrayU8 (boofcv.struct.image.GrayU8)4 Random (java.util.Random)4 GrayF32 (boofcv.struct.image.GrayF32)2 BorderIndex1D_Wrap (boofcv.core.image.border.BorderIndex1D_Wrap)1 ImageBorder1D_F32 (boofcv.core.image.border.ImageBorder1D_F32)1 Kernel1D_S32 (boofcv.struct.convolve.Kernel1D_S32)1 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)1 ImageGray (boofcv.struct.image.ImageGray)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1