Search in sources :

Example 16 with GrayS16

use of boofcv.struct.image.GrayS16 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);
}
Also used : CompareDerivativeToConvolution(boofcv.alg.filter.derivative.CompareDerivativeToConvolution) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 17 with GrayS16

use of boofcv.struct.image.GrayS16 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 18 with GrayS16

use of boofcv.struct.image.GrayS16 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 19 with GrayS16

use of boofcv.struct.image.GrayS16 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 20 with GrayS16

use of boofcv.struct.image.GrayS16 in project BoofCV by lessthanoptimal.

the class TestSparseFlowObjectTracker method checkMotion.

protected void checkMotion(double tranX, double tranY, double rot) {
    GrayU8 frame0 = new GrayU8(320, 240);
    GrayU8 frame1 = new GrayU8(320, 240);
    ImageMiscOps.fillUniform(frame0, rand, 0, 256);
    double c = Math.cos(rot);
    double s = Math.sin(rot);
    new FDistort(frame0, frame1).affine(c, -s, s, c, tranX, tranY).apply();
    SfotConfig config = new SfotConfig();
    ImageGradient<GrayU8, GrayS16> gradient = FactoryDerivative.sobel(GrayU8.class, GrayS16.class);
    SparseFlowObjectTracker<GrayU8, GrayS16> alg = new SparseFlowObjectTracker<>(config, GrayU8.class, GrayS16.class, gradient);
    RectangleRotate_F64 region0 = new RectangleRotate_F64(120, 140, 30, 40, 0.1);
    RectangleRotate_F64 region1 = new RectangleRotate_F64();
    alg.init(frame0, region0);
    assertTrue(alg.update(frame1, region1));
    double expectedX = c * region0.cx - s * region0.cy + tranX;
    double expectedY = s * region0.cx + c * region0.cy + tranY;
    double expectedYaw = UtilAngle.bound(region0.theta + rot);
    assertEquals(expectedX, region1.cx, 0.5);
    assertEquals(expectedY, region1.cy, 0.5);
    assertEquals(expectedYaw, region1.theta, 0.01);
}
Also used : FDistort(boofcv.abst.distort.FDistort) GrayS16(boofcv.struct.image.GrayS16) GrayU8(boofcv.struct.image.GrayU8) RectangleRotate_F64(boofcv.struct.RectangleRotate_F64)

Aggregations

GrayS16 (boofcv.struct.image.GrayS16)63 GrayU8 (boofcv.struct.image.GrayU8)45 Test (org.junit.Test)39 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)15 GrayF32 (boofcv.struct.image.GrayF32)13 Random (java.util.Random)8 CompareDerivativeToConvolution (boofcv.alg.filter.derivative.CompareDerivativeToConvolution)7 BorderIndex1D_Extend (boofcv.core.image.border.BorderIndex1D_Extend)4 ImageBorder1D_S32 (boofcv.core.image.border.ImageBorder1D_S32)4 ImageGray (boofcv.struct.image.ImageGray)4 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 BufferedImage (java.awt.image.BufferedImage)3 WrapDisparitySadRect (boofcv.abst.feature.disparity.WrapDisparitySadRect)2 DisparitySelect (boofcv.alg.feature.disparity.DisparitySelect)2 ImageBorder_F32 (boofcv.core.image.border.ImageBorder_F32)2 ListDisplayPanel (boofcv.gui.ListDisplayPanel)2 Kernel1D_S32 (boofcv.struct.convolve.Kernel1D_S32)2 FDistort (boofcv.abst.distort.FDistort)1 DetectLineSegmentsGridRansac (boofcv.abst.feature.detect.line.DetectLineSegmentsGridRansac)1 EdgeContour (boofcv.alg.feature.detect.edge.EdgeContour)1