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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations