Search in sources :

Example 6 with BrightFeature

use of boofcv.struct.feature.BrightFeature in project BoofCV by lessthanoptimal.

the class ExampleImageStitching method stitch.

/**
 * Given two input images create and display an image where the two have been overlayed on top of each other.
 */
public static <T extends ImageGray<T>> void stitch(BufferedImage imageA, BufferedImage imageB, Class<T> imageType) {
    T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType);
    T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType);
    // Detect using the standard SURF feature descriptor and describer
    DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable(new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null, null, imageType);
    ScoreAssociation<BrightFeature> scorer = FactoryAssociation.scoreEuclidean(BrightFeature.class, true);
    AssociateDescription<BrightFeature> associate = FactoryAssociation.greedy(scorer, 2, true);
    // fit the images using a homography.  This works well for rotations and distant objects.
    ModelMatcher<Homography2D_F64, AssociatedPair> modelMatcher = FactoryMultiViewRobust.homographyRansac(null, new ConfigRansac(60, 3));
    Homography2D_F64 H = computeTransform(inputA, inputB, detDesc, associate, modelMatcher);
    renderStitching(imageA, imageB, H);
}
Also used : DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint) AssociatedPair(boofcv.struct.geo.AssociatedPair) BrightFeature(boofcv.struct.feature.BrightFeature) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian) ConfigRansac(boofcv.factory.geo.ConfigRansac) Homography2D_F64(georegression.struct.homography.Homography2D_F64)

Example 7 with BrightFeature

use of boofcv.struct.feature.BrightFeature in project BoofCV by lessthanoptimal.

the class BaseTestDescribeSurf method features_constant.

/**
 * If the image has a constant value then all the features should be zero.
 */
@Test
public void features_constant() {
    GImageMiscOps.fill(input, 50);
    GIntegralImageOps.transform(input, ii);
    sparse = TestImplSurfDescribeOps.createGradient(ii, 1);
    alg.setImage(ii);
    BrightFeature feat = alg.createDescription();
    alg.describe(20, 20, 0.75, 1, feat);
    for (double f : feat.value) assertEquals(0, f, 1e-4);
}
Also used : BrightFeature(boofcv.struct.feature.BrightFeature) Test(org.junit.Test)

Example 8 with BrightFeature

use of boofcv.struct.feature.BrightFeature in project BoofCV by lessthanoptimal.

the class BaseTestDescribeSurf method features_fraction.

/**
 * Give it a scale factor which is a fraction and see if it blows up
 */
@Test
public void features_fraction() {
    // test the gradient along the x-axis only
    TestImplSurfDescribeOps.createGradient(0, input);
    GIntegralImageOps.transform(input, ii);
    sparse = TestImplSurfDescribeOps.createGradient(ii, 1.5);
    // orient the feature along the x-axis
    alg.setImage(ii);
    BrightFeature feat = alg.createDescription();
    alg.describe(25, 25, 0, 1.5, feat);
    for (int i = 0; i < 64; i += 4) {
        assertEquals(feat.value[i], feat.value[i + 1], 1e-4);
        assertTrue(feat.value[i] > 0);
        assertEquals(0, feat.value[i + 2], 1e-4);
        assertEquals(0, feat.value[i + 3], 1e-4);
    }
}
Also used : BrightFeature(boofcv.struct.feature.BrightFeature) Test(org.junit.Test)

Example 9 with BrightFeature

use of boofcv.struct.feature.BrightFeature in project BoofCV by lessthanoptimal.

the class BaseTestDescribeSurf method checkSubImage.

/**
 * Does it produce a the same features when given a subimage?
 */
@Test
public void checkSubImage() {
    GImageMiscOps.fillUniform(ii, rand, 0, 100);
    alg.setImage(ii);
    BrightFeature expected = alg.createDescription();
    alg.describe(c_x, c_y, 0, 1, expected);
    II sub = BoofTesting.createSubImageOf(ii);
    alg.setImage(sub);
    BrightFeature found = alg.createDescription();
    alg.describe(c_x, c_y, 0, 1, found);
    assertTrue(isSimilar(expected, found));
}
Also used : BrightFeature(boofcv.struct.feature.BrightFeature) Test(org.junit.Test)

Example 10 with BrightFeature

use of boofcv.struct.feature.BrightFeature in project BoofCV by lessthanoptimal.

the class BaseTestDescribeSurf method changeRotation.

/**
 * Does it produce a different feature when rotated?
 */
@Test
public void changeRotation() {
    GImageMiscOps.fillUniform(ii, rand, 0, 100);
    alg.setImage(ii);
    BrightFeature a = alg.createDescription();
    BrightFeature b = alg.createDescription();
    alg.describe(c_x, c_y, 0, 1, a);
    alg.describe(c_x, c_y, 1, 1, b);
    assertFalse(isSimilar(a, b));
}
Also used : BrightFeature(boofcv.struct.feature.BrightFeature) Test(org.junit.Test)

Aggregations

BrightFeature (boofcv.struct.feature.BrightFeature)22 Test (org.junit.Test)11 GrayF32 (boofcv.struct.image.GrayF32)6 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)4 ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)4 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)3 ScalePoint (boofcv.struct.feature.ScalePoint)3 AssociatedPair (boofcv.struct.geo.AssociatedPair)3 OrientationImage (boofcv.abst.feature.orientation.OrientationImage)2 ArrayList (java.util.ArrayList)2 FastQueue (org.ddogleg.struct.FastQueue)2 GrowQueue_F64 (org.ddogleg.struct.GrowQueue_F64)2 GrowQueue_I32 (org.ddogleg.struct.GrowQueue_I32)2 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)1 NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)1 FastHessianFeatureDetector (boofcv.alg.feature.detect.interest.FastHessianFeatureDetector)1 ExampleAssociatePoints (boofcv.examples.features.ExampleAssociatePoints)1 ConfigRansac (boofcv.factory.geo.ConfigRansac)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 SurfFeatureQueue (boofcv.struct.feature.SurfFeatureQueue)1