use of boofcv.struct.feature.TupleDesc_B in project BoofCV by lessthanoptimal.
the class TestDescribePointBriefSO method checkBorder.
/**
* See if it handles the image border correctly.
*/
@Test
void checkBorder() {
GrayF32 input = createImage(width, height);
DescribePointBriefSO<GrayF32> alg = createAlg();
alg.setImage(input);
TupleDesc_B desc = alg.createFeature();
// part of sanity check
assertEquals(desc.data[0], 0);
// just see if it blows up for now. a more rigorous test would be better
alg.process(0, 0, 0.1f, briefRadius * 1.2f, desc);
alg.process(width - 1, height - 1, 0.1f, briefRadius * 1.2f, desc);
// sanity check. the description should not be zero
assertTrue(desc.data[0] != 0);
}
use of boofcv.struct.feature.TupleDesc_B in project BoofCV by lessthanoptimal.
the class TestDescribePointBriefSO method testSubImage.
/**
* Have brief process a sub-image and see if it produces the same results.
*/
@Test
void testSubImage() {
GrayF32 input = createImage(width, height);
DescribePointBriefSO<GrayF32> alg = createAlg();
TupleDesc_B desc1 = alg.createFeature();
TupleDesc_B desc2 = alg.createFeature();
// resize the image and see if it computes the same output
alg.setImage(input);
alg.process(input.width / 2, input.height / 2, 0, briefRadius, desc1);
GrayF32 sub = BoofTesting.createSubImageOf(input);
alg.setImage(sub);
alg.process(input.width / 2, input.height / 2, 0, briefRadius, desc2);
for (int i = 0; i < desc1.data.length; i++) {
assertEquals(desc1.data[i], desc2.data[i]);
}
}
use of boofcv.struct.feature.TupleDesc_B in project BoofCV by lessthanoptimal.
the class TestDescribePointBriefSO method testManualCheck.
/**
* Compute the BRIEF descriptor manually and see if it gets the same answer
*/
@Test
void testManualCheck() {
GrayF32 input = createImage(width, height);
GrayF32 blurred = input.createNew(width, height);
filterBlur.process(input, blurred);
InterpolatePixelS<GrayF32> interp = FactoryInterpolation.bilinearPixelS(GrayF32.class, BorderType.EXTENDED);
interp.setImage(blurred);
DescribePointBriefSO<GrayF32> alg = createAlg();
alg.setImage(input);
int c_x = input.width / 2;
int c_y = input.height / 2;
TupleDesc_B desc = alg.createFeature();
alg.process(c_x, c_y, 0, briefRadius, desc);
double s = briefRadius / BoofDefaults.BRIEF_SCALE_TO_RADIUS;
for (int i = 0; i < def.compare.length; i++) {
Point2D_I32 c = def.compare[i];
Point2D_I32 p0 = def.samplePoints[c.x];
Point2D_I32 p1 = def.samplePoints[c.y];
boolean expected = interp.get((float) (c_x + p0.x * s), (float) (c_y + p0.y * s)) < interp.get((float) (c_x + p1.x * s), (float) (c_y + p1.y * s));
assertEquals(desc.isBitTrue(i), expected);
}
}
use of boofcv.struct.feature.TupleDesc_B in project BoofCV by lessthanoptimal.
the class TestDescribePointBriefSO method changeInInputSize.
/**
* Change the input image size and see if it handles that case properly.
*/
@Test
void changeInInputSize() {
GrayF32 inputA = createImage(width, height);
GrayF32 inputB = createImage(width - 5, height - 5);
DescribePointBriefSO<GrayF32> alg = createAlg();
TupleDesc_B desc = alg.createFeature();
alg.setImage(inputA);
alg.process(inputA.width / 2, inputA.height / 2, 0, briefRadius, desc);
// just see if it blows up or not
alg.setImage(inputB);
alg.process(inputA.width / 2, inputA.height / 2, 0, briefRadius, desc);
}
use of boofcv.struct.feature.TupleDesc_B in project BoofCV by lessthanoptimal.
the class BaseTestDescribePointBinaryCompare method changeInInputSize.
/**
* Change the input image size and see if it handles that case properly.
*/
@Test
void changeInInputSize() {
T inputA = createImage(width, height);
T inputB = createImage(width - 5, height - 5);
DescribePointBinaryCompare<T> alg = createAlg(def);
TupleDesc_B desc = createFeature();
alg.setImage(inputA);
alg.process(inputA.width / 2, inputA.height / 2, desc);
// just see if it blows up or not
alg.setImage(inputB);
alg.process(inputA.width / 2, inputA.height / 2, desc);
}
Aggregations