use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestDetectDescribeAssociate method addNewTrack.
@Test
public void addNewTrack() {
Helper dat = new Helper();
TupleDesc_F64 desc = dat.manager.createDescription();
desc.value[0] = 5;
PointTrack found0 = dat.addNewTrack(5, 10, desc);
PointTrack found1 = dat.addNewTrack(8, 23, desc);
// unique featureId should be assigned
assertTrue(found0.featureId != found1.featureId);
// make sure a copy is made
assertTrue(found0.getDescription() != desc);
assertTrue(((TupleDesc_F64) found0.getDescription()).value[0] == 5);
// should check to see if the feature is valid
assertTrue(dat.validCalled);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestAssociateStereo2D method positive.
/**
* Very simple positive case with only a perfect observation and descriptor
*/
@Test
public void positive() {
Point3D_F64 X = new Point3D_F64(0.02, -0.5, 3);
SfmTestHelper.renderPointPixel(param, X, leftP, rightP);
pointsLeft.grow().set(leftP);
pointsRight.grow().set(rightP);
descLeft.grow();
descRight.grow();
AssociateStereo2D<TupleDesc_F64> alg = new AssociateStereo2D<>(scorer, 0.5, TupleDesc_F64.class);
alg.setCalibration(param);
alg.setSource(pointsLeft, descLeft);
alg.setDestination(pointsRight, descRight);
alg.associate();
FastQueue<AssociatedIndex> matches = alg.getMatches();
assertEquals(1, matches.size);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestAssociateStereo2D method setup.
@Before
public void setup() {
leftToRight = new Se3_F64();
ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.01, -0.001, 0.005, leftToRight.getR());
leftToRight.getT().set(-0.1, 0, 0);
param = new StereoParameters();
param.rightToLeft = leftToRight.invert(null);
param.left = new CameraPinholeRadial(400, 500, 0.1, 160, 120, 320, 240).fsetRadial(0, 0);
param.right = new CameraPinholeRadial(380, 505, 0.05, 165, 115, 320, 240).fsetRadial(0, 0);
descLeft = new FastQueue<TupleDesc_F64>(TupleDesc_F64.class, true) {
@Override
protected TupleDesc_F64 createInstance() {
return new TupleDesc_F64(10);
}
};
descRight = new FastQueue<TupleDesc_F64>(TupleDesc_F64.class, true) {
@Override
protected TupleDesc_F64 createInstance() {
return new TupleDesc_F64(10);
}
};
pointsLeft.reset();
pointsRight.reset();
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestAssociateStereo2D method constraintX.
/**
* Makes the observation in the left image > right image along x-axis
*/
@Test
public void constraintX() {
// zap the rotation so that no adjustment should need to be done
CommonOps_DDRM.setIdentity(param.rightToLeft.getR());
Point3D_F64 X = new Point3D_F64(0.02, -0.5, 3);
SfmTestHelper.renderPointPixel(param, X, leftP, rightP);
// mangle the x-axis
leftP.x = rightP.x - 0.25;
pointsLeft.grow().set(leftP);
pointsRight.grow().set(rightP);
descLeft.grow();
descRight.grow();
AssociateStereo2D<TupleDesc_F64> alg = new AssociateStereo2D<>(scorer, 0.5, TupleDesc_F64.class);
alg.setCalibration(param);
alg.setSource(pointsLeft, descLeft);
alg.setDestination(pointsRight, descRight);
alg.associate();
// at the current tolerance they should still match
assertEquals(1, alg.getMatches().size);
// make the tolerance tighter
alg = new AssociateStereo2D<>(scorer, 0.01, TupleDesc_F64.class);
alg.setCalibration(param);
alg.setSource(pointsLeft, descLeft);
alg.setDestination(pointsRight, descRight);
alg.associate();
assertEquals(0, alg.getMatches().size);
}
use of boofcv.struct.feature.TupleDesc_F64 in project BoofCV by lessthanoptimal.
the class TestGHistogramFeatureOps method histogram_sb.
@Test
public void histogram_sb() {
for (Class type : supported) {
ImageGray image = GeneralizedImageOps.createSingleBand(type, width, height);
GImageMiscOps.fillUniform(image, rand, 0, 200);
TupleDesc_F64 found = new TupleDesc_F64(200);
TupleDesc_F64 expected = new TupleDesc_F64(200);
GHistogramFeatureOps.histogram(image, 0, 200, found);
if (type == GrayF32.class) {
HistogramFeatureOps.histogram((GrayF32) image, 0, 200, expected);
} else {
HistogramFeatureOps.histogram((GrayU8) image, 200, expected);
}
assertEquals(0, DescriptorDistance.euclidean(expected, found), 1e-8);
}
}
Aggregations