use of boofcv.struct.image.GrayS8 in project BoofCV by lessthanoptimal.
the class TestImplEdgeNonMaxSuppression method naive8.
@Test
public void naive8() {
GrayF32 intensity = new GrayF32(3, 3);
GrayF32 output = new GrayF32(3, 3);
GrayS8 direction = new GrayS8(3, 3);
// test it against simple positive and negative cases
for (int dir = -3; dir < 5; dir++) {
direction.set(1, 1, dir);
GImageMiscOps.fill(intensity, 0);
intensity.set(1, 1, 10);
// test suppress
setByDirection8(intensity, dir, 15);
ImplEdgeNonMaxSuppression.naive8(intensity, direction, output);
assertEquals(0, output.get(1, 1), 1e-4f);
// test no suppression
setByDirection8(intensity, dir, 5);
ImplEdgeNonMaxSuppression.naive8(intensity, direction, output);
assertEquals(intensity.get(1, 1), output.get(1, 1), 1e-4f);
}
}
use of boofcv.struct.image.GrayS8 in project BoofCV by lessthanoptimal.
the class TestDescribePlanar method checkNumBands.
/**
* Sanity check to see if input image and number of descriptors is the same
*/
@Test(expected = IllegalArgumentException.class)
public void checkNumBands() {
DescribeRegionPoint[] descs = new DummyDesc[3];
descs[0] = new DummyDesc();
descs[1] = new DummyDesc();
descs[2] = new DummyDesc();
DummyAlg alg = new DummyAlg(descs);
alg.setImage(new Planar(GrayS8.class, 1, 1, 2));
}
use of boofcv.struct.image.GrayS8 in project BoofCV by lessthanoptimal.
the class TestDescribePlanar method various.
@Test
public void various() {
DescribeRegionPoint[] descs = new DummyDesc[3];
descs[0] = new DummyDesc();
descs[1] = new DummyDesc();
descs[2] = new DummyDesc();
DummyAlg alg = new DummyAlg(descs);
alg.setImage(new Planar(GrayS8.class, 1, 1, 3));
alg.process(0, 1, 2, 3, alg.createDescription());
assertEquals(30, alg.createDescription().size());
assertEquals(1, alg.numCombined);
for (int i = 0; i < 3; i++) {
assertEquals(1, ((DummyDesc) descs[i]).numProcess);
}
}
use of boofcv.struct.image.GrayS8 in project BoofCV by lessthanoptimal.
the class TestGradientToEdgeFeatures method nonMaxSuppression4.
@Test
public void nonMaxSuppression4() {
GrayF32 intensity = new GrayF32(width, height);
GrayS8 direction = new GrayS8(width, height);
GrayF32 expected = new GrayF32(width, height);
GrayF32 found = new GrayF32(width, height);
BoofTesting.checkSubImage(this, "nonMaxSuppression4", true, intensity, direction, expected, found);
}
use of boofcv.struct.image.GrayS8 in project BoofCV by lessthanoptimal.
the class TestGradientToEdgeFeatures method discretizeDirection4.
@Test
public void discretizeDirection4() {
GrayF32 angle = new GrayF32(5, 5);
angle.set(0, 0, (float) (3 * Math.PI / 8 + 0.01));
angle.set(1, 0, (float) (3 * Math.PI / 8 - 0.01));
angle.set(2, 0, (float) (Math.PI / 4));
angle.set(3, 0, (float) (Math.PI / 8 + 0.01));
angle.set(4, 0, (float) (Math.PI / 8 - 0.01));
angle.set(0, 1, (float) (-3 * Math.PI / 8 + 0.01));
angle.set(1, 1, (float) (-3 * Math.PI / 8 - 0.01));
GrayS8 d = new GrayS8(5, 5);
GradientToEdgeFeatures.discretizeDirection4(angle, d);
assertEquals(2, d.get(0, 0));
assertEquals(1, d.get(1, 0));
assertEquals(1, d.get(2, 0));
assertEquals(1, d.get(3, 0));
assertEquals(0, d.get(4, 0));
assertEquals(-1, d.get(0, 1));
assertEquals(2, d.get(1, 1));
}
Aggregations