Search in sources :

Example 16 with TupleDesc_B

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);
}
Also used : TupleDesc_B(boofcv.struct.feature.TupleDesc_B) GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.jupiter.api.Test)

Example 17 with TupleDesc_B

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]);
    }
}
Also used : TupleDesc_B(boofcv.struct.feature.TupleDesc_B) GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.jupiter.api.Test)

Example 18 with TupleDesc_B

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);
    }
}
Also used : TupleDesc_B(boofcv.struct.feature.TupleDesc_B) GrayF32(boofcv.struct.image.GrayF32) Point2D_I32(georegression.struct.point.Point2D_I32) Test(org.junit.jupiter.api.Test)

Example 19 with TupleDesc_B

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);
}
Also used : TupleDesc_B(boofcv.struct.feature.TupleDesc_B) GrayF32(boofcv.struct.image.GrayF32) Test(org.junit.jupiter.api.Test)

Example 20 with TupleDesc_B

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);
}
Also used : TupleDesc_B(boofcv.struct.feature.TupleDesc_B) Test(org.junit.jupiter.api.Test)

Aggregations

TupleDesc_B (boofcv.struct.feature.TupleDesc_B)24 Test (org.junit.jupiter.api.Test)14 GrayF32 (boofcv.struct.image.GrayF32)11 Random (java.util.Random)6 ScoreAssociateHamming_B (boofcv.abst.feature.associate.ScoreAssociateHamming_B)4 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)4 Point2D_I32 (georegression.struct.point.Point2D_I32)4 AssociateDescTo2D (boofcv.abst.feature.associate.AssociateDescTo2D)2 WrapDescribeBrief (boofcv.abst.feature.describe.WrapDescribeBrief)2 EasyGeneralFeatureDetector (boofcv.alg.feature.detect.interest.EasyGeneralFeatureDetector)2 DogArray_I32 (org.ddogleg.struct.DogArray_I32)2 DetectDescribeFusion (boofcv.abst.feature.detdesc.DetectDescribeFusion)1 AssociateMaxDistanceNaive (boofcv.alg.feature.associate.AssociateMaxDistanceNaive)1 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)1 GImageGray (boofcv.core.image.GImageGray)1 ArrayList (java.util.ArrayList)1 ListAccessor (org.ddogleg.clustering.misc.ListAccessor)1 DogArray (org.ddogleg.struct.DogArray)1