use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestGenericDenseDescribeImage method process.
/**
* Give it a known situation and see if it produces the expected results
*/
@Test
void process() {
DummyFeature sparse = new DummyFeature();
GenericDenseDescribeImageDense alg = new GenericDenseDescribeImageDense(sparse, 1.5, 3, 4);
GrayU8 image = new GrayU8(100, 110);
alg.process(image);
List<TupleDesc_F64> descs = alg.getDescriptions();
List<Point2D_I32> points = alg.getLocations();
assertEquals(descs.size(), points.size());
int featureRadius = (int) Math.round(1.5 * 7.0 / 2.0);
int w = (100 - 2 * featureRadius) / 3;
int h = (110 - 2 * featureRadius) / 4;
// -1 since it intentionally skips feature 20
assertEquals(w * h - 1, points.size());
int count = 0;
for (int y = 0; y < h; y++) {
int pixelY = featureRadius + y * y;
for (int x = 0; x < w; x++) {
int pixelX = featureRadius + x * 3;
Point2D_I32 p = null;
if (count < 19) {
p = points.get(count);
} else if (count > 20) {
p = points.get(count + 1);
} else {
continue;
}
assertEquals(pixelX, p.x);
assertEquals(pixelY, p.y);
count++;
}
}
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestDescribeSift_RadiusAngle method process.
@Test
void process() {
GrayF32 image = new GrayF32(640, 480);
GImageMiscOps.fillUniform(image, rand, 0, 200);
DescribeSift_RadiusAngle<GrayF32> alg = declare();
alg.setImage(image);
TupleDesc_F64 desc0 = alg.createDescription();
TupleDesc_F64 desc1 = alg.createDescription();
TupleDesc_F64 desc2 = alg.createDescription();
// same location, but different orientations and scales
assertTrue(alg.process(100, 120, 0.5, 10, desc0));
assertTrue(alg.process(100, 50, -1.1, 10, desc1));
assertTrue(alg.process(100, 50, 0.5, 7, desc2));
// should be 3 different descriptions
assertNotEquals(desc0.getDouble(0), desc1.getDouble(0), 1e-6);
assertNotEquals(desc0.getDouble(0), desc2.getDouble(0), 1e-6);
assertNotEquals(desc1.getDouble(0), desc2.getDouble(0), 1e-6);
// see if it blows up along the image border
assertTrue(alg.process(0, 120, 0.5, 10, desc0));
assertTrue(alg.process(100, 0, 0.5, 10, desc0));
assertTrue(alg.process(639, 120, 0.5, 10, desc0));
assertTrue(alg.process(100, 479, 0.5, 10, desc0));
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestConvertTupleDescSigned_F64_S8 method convert.
@Test
void convert() {
var alg = new ConvertTupleDescSigned_F64_S8(5);
var input = new TupleDesc_F64(5);
input.data = new double[] { -2.5, 3, 20, -243.45 };
TupleDesc_S8 found = alg.createOutput();
alg.convert(input, found);
TupleDesc_S8 expected = alg.createOutput();
ConvertDescriptors.signed(input, expected);
for (int i = 0; i < 5; i++) {
assertEquals(expected.data[i], found.data[i]);
}
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestAssociateDescriptionSets2D method c.
protected static TupleDesc_F64 c(double value) {
TupleDesc_F64 s = new TupleDesc_F64(1);
s.data[0] = value;
return s;
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestScoreAssociateCorrelation method compareToExpected.
@Test
void compareToExpected() {
ScoreAssociateCorrelation score = new ScoreAssociateCorrelation();
TupleDesc_F64 a = new TupleDesc_F64(5);
TupleDesc_F64 b = new TupleDesc_F64(5);
a.data = new double[] { 1, 2, 3, 4, 5 };
b.data = new double[] { 2, -1, 7, -8, 10 };
assertEquals(-39, score.score(a, b), 1e-2);
}
Aggregations