Search in sources :

Example 1 with DescribeRegionPoint

use of boofcv.abst.feature.describe.DescribeRegionPoint in project BoofCV by lessthanoptimal.

the class TestDetectDescribeMultiFusion method checkFeatureNotInBounds.

/**
 * If a feature is not in bounds make sure everything is handled correctly
 */
@Test
public void checkFeatureNotInBounds() {
    DetectorInterestPointMulti detector = new DummyDetector(2);
    DescribeRegionPoint describe = new TestDetectDescribeFusion.DummyRegionPoint();
    DetectDescribeMultiFusion alg = new DetectDescribeMultiFusion(detector, null, describe);
    alg.process(new GrayF32(2, 2));
    assertEquals(2, alg.getNumberOfSets());
    for (int n = 0; n < alg.getNumberOfSets(); n++) {
        PointDescSet set = alg.getFeatureSet(n);
        // one feature should not be inside the image
        if (n == 0)
            assertEquals(n + 8, set.getNumberOfFeatures());
        else
            assertEquals(n + 9, set.getNumberOfFeatures());
        for (int i = 0; i < set.getNumberOfFeatures(); i++) {
            assertTrue(set.getDescription(i) != null);
            assertTrue(set.getLocation(i) != null);
        }
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) DetectorInterestPointMulti(boofcv.abst.feature.detect.interest.DetectorInterestPointMulti) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) FactoryInterestPoint(boofcv.factory.feature.detect.interest.FactoryInterestPoint) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) Test(org.junit.Test)

Example 2 with DescribeRegionPoint

use of boofcv.abst.feature.describe.DescribeRegionPoint in project BoofCV by lessthanoptimal.

the class VisualizeStereoVisualOdometryApp method createStereoDepth.

private StereoVisualOdometry<I> createStereoDepth(int whichAlg) {
    Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
    StereoDisparitySparse<I> disparity = FactoryStereoDisparity.regionSparseWta(2, 150, 3, 3, 30, -1, true, imageType);
    PkltConfig kltConfig = new PkltConfig();
    kltConfig.templateRadius = 3;
    kltConfig.pyramidScaling = new int[] { 1, 2, 4, 8 };
    if (whichAlg == 0) {
        ConfigGeneralDetector configDetector = new ConfigGeneralDetector(600, 3, 1);
        PointTrackerTwoPass<I> tracker = FactoryPointTrackerTwoPass.klt(kltConfig, configDetector, imageType, derivType);
        return FactoryVisualOdometry.stereoDepth(1.5, 120, 2, 200, 50, false, disparity, tracker, imageType);
    } else if (whichAlg == 1) {
        ConfigGeneralDetector configExtract = new ConfigGeneralDetector(600, 3, 1);
        GeneralFeatureDetector detector = FactoryPointTracker.createShiTomasi(configExtract, derivType);
        DescribeRegionPoint describe = FactoryDescribeRegionPoint.brief(null, imageType);
        ScoreAssociateHamming_B score = new ScoreAssociateHamming_B();
        AssociateDescription2D<TupleDesc_B> associate = new AssociateDescTo2D<>(FactoryAssociation.greedy(score, 150, true));
        PointTrackerTwoPass tracker = FactoryPointTrackerTwoPass.dda(detector, describe, associate, null, 1, imageType);
        return FactoryVisualOdometry.stereoDepth(1.5, 80, 3, 200, 50, false, disparity, tracker, imageType);
    } else if (whichAlg == 2) {
        PointTracker<I> tracker = FactoryPointTracker.combined_ST_SURF_KLT(new ConfigGeneralDetector(600, 3, 0), kltConfig, 50, null, null, imageType, derivType);
        PointTrackerTwoPass<I> twopass = new PointTrackerToTwoPass<>(tracker);
        return FactoryVisualOdometry.stereoDepth(1.5, 80, 3, 200, 50, false, disparity, twopass, imageType);
    } else if (whichAlg == 3) {
        ConfigGeneralDetector configDetector = new ConfigGeneralDetector(600, 3, 1);
        PointTracker<I> trackerLeft = FactoryPointTracker.klt(kltConfig, configDetector, imageType, derivType);
        PointTracker<I> trackerRight = FactoryPointTracker.klt(kltConfig, configDetector, imageType, derivType);
        DescribeRegionPoint describe = FactoryDescribeRegionPoint.surfFast(null, imageType);
        return FactoryVisualOdometry.stereoDualTrackerPnP(90, 2, 1.5, 1.5, 200, 50, trackerLeft, trackerRight, describe, imageType);
    } else if (whichAlg == 4) {
        // GeneralFeatureIntensity intensity =
        // FactoryIntensityPoint.hessian(HessianBlobIntensity.Type.TRACE,defaultType);
        GeneralFeatureIntensity intensity = FactoryIntensityPoint.shiTomasi(1, false, imageType);
        NonMaxSuppression nonmax = FactoryFeatureExtractor.nonmax(new ConfigExtract(2, 50, 0, true, false, true));
        GeneralFeatureDetector general = new GeneralFeatureDetector(intensity, nonmax);
        general.setMaxFeatures(600);
        DetectorInterestPointMulti detector = new GeneralToInterestMulti(general, 2, imageType, derivType);
        // DescribeRegionPoint describe = FactoryDescribeRegionPoint.brief(new ConfigBrief(true),defaultType);
        // DescribeRegionPoint describe = FactoryDescribeRegionPoint.pixelNCC(5,5,defaultType);
        DescribeRegionPoint describe = FactoryDescribeRegionPoint.surfFast(null, imageType);
        DetectDescribeMulti detDescMulti = new DetectDescribeMultiFusion(detector, null, describe);
        return FactoryVisualOdometry.stereoQuadPnP(1.5, 0.5, 75, Double.MAX_VALUE, 300, 50, detDescMulti, imageType);
    } else {
        throw new RuntimeException("Unknown selection");
    }
}
Also used : NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) GeneralToInterestMulti(boofcv.abst.feature.detect.interest.GeneralToInterestMulti) PkltConfig(boofcv.alg.tracker.klt.PkltConfig) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) ConfigGeneralDetector(boofcv.abst.feature.detect.interest.ConfigGeneralDetector) DetectDescribeMultiFusion(boofcv.abst.feature.detdesc.DetectDescribeMultiFusion) DetectorInterestPointMulti(boofcv.abst.feature.detect.interest.DetectorInterestPointMulti) ScoreAssociateHamming_B(boofcv.abst.feature.associate.ScoreAssociateHamming_B) FactoryPointTrackerTwoPass(boofcv.factory.feature.tracker.FactoryPointTrackerTwoPass) PointTrackerTwoPass(boofcv.abst.feature.tracker.PointTrackerTwoPass) ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) DetectDescribeMulti(boofcv.abst.feature.detdesc.DetectDescribeMulti) GeneralFeatureDetector(boofcv.alg.feature.detect.interest.GeneralFeatureDetector) PointTrackerToTwoPass(boofcv.abst.feature.tracker.PointTrackerToTwoPass) AssociateDescription2D(boofcv.abst.feature.associate.AssociateDescription2D) PointTracker(boofcv.abst.feature.tracker.PointTracker) FactoryPointTracker(boofcv.factory.feature.tracker.FactoryPointTracker) GeneralFeatureIntensity(boofcv.abst.feature.detect.intensity.GeneralFeatureIntensity)

Example 3 with DescribeRegionPoint

use of boofcv.abst.feature.describe.DescribeRegionPoint in project BoofCV by lessthanoptimal.

the class TestDescribePlanar method checkNumBands.

/**
 * Sanity check to see if input image and number of descriptors is the same
 */
@Test(expected = IllegalArgumentException.class)
public void checkNumBands() {
    DescribeRegionPoint[] descs = new DummyDesc[3];
    descs[0] = new DummyDesc();
    descs[1] = new DummyDesc();
    descs[2] = new DummyDesc();
    DummyAlg alg = new DummyAlg(descs);
    alg.setImage(new Planar(GrayS8.class, 1, 1, 2));
}
Also used : GrayS8(boofcv.struct.image.GrayS8) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) Planar(boofcv.struct.image.Planar) Test(org.junit.Test)

Example 4 with DescribeRegionPoint

use of boofcv.abst.feature.describe.DescribeRegionPoint in project BoofCV by lessthanoptimal.

the class CompareConvertedDescriptionsApp method describeImage.

public static <TD extends TupleDesc> FastQueue<TD> describeImage(GrayF32 input, InterestPointDetector<GrayF32> detector, DescribeRegionPoint<GrayF32, TD> describe, List<Point2D_F64> location) {
    FastQueue<TD> list = new FastQueue<>(100, describe.getDescriptionType(), false);
    System.out.println("Detecting");
    detector.detect(input);
    System.out.println("Describing");
    describe.setImage(input);
    for (int i = 0; i < detector.getNumberOfFeatures(); i++) {
        Point2D_F64 p = detector.getLocation(i);
        double radius = detector.getRadius(i);
        double ori = detector.getOrientation(i);
        TD d = describe.createDescription();
        if (describe.process(p.x, p.y, ori, radius, d)) {
            list.add(d);
            location.add(p.copy());
        }
    }
    return list;
}
Also used : Point2D_F64(georegression.struct.point.Point2D_F64) FastQueue(org.ddogleg.struct.FastQueue) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) FactoryInterestPoint(boofcv.factory.feature.detect.interest.FactoryInterestPoint)

Example 5 with DescribeRegionPoint

use of boofcv.abst.feature.describe.DescribeRegionPoint in project BoofCV by lessthanoptimal.

the class TestWrapVisOdomQuadPnP method createAlgorithm.

@Override
public StereoVisualOdometry<GrayF32> createAlgorithm() {
    GeneralFeatureIntensity intensity = FactoryIntensityPoint.shiTomasi(1, false, GrayF32.class);
    NonMaxSuppression nonmax = FactoryFeatureExtractor.nonmax(new ConfigExtract(2, 1, 0, true, false, true));
    GeneralFeatureDetector<GrayF32, GrayF32> general = new GeneralFeatureDetector<>(intensity, nonmax);
    general.setMaxFeatures(600);
    DetectorInterestPointMulti detector = new GeneralToInterestMulti(general, 2, GrayF32.class, GrayF32.class);
    DescribeRegionPoint describe = FactoryDescribeRegionPoint.surfFast(null, GrayF32.class);
    DetectDescribeMulti detDescMulti = new DetectDescribeMultiFusion(detector, null, describe);
    return FactoryVisualOdometry.stereoQuadPnP(1.5, 0.5, 200, Double.MAX_VALUE, 300, 50, detDescMulti, GrayF32.class);
}
Also used : ConfigExtract(boofcv.abst.feature.detect.extract.ConfigExtract) DetectDescribeMulti(boofcv.abst.feature.detdesc.DetectDescribeMulti) NonMaxSuppression(boofcv.abst.feature.detect.extract.NonMaxSuppression) GrayF32(boofcv.struct.image.GrayF32) GeneralToInterestMulti(boofcv.abst.feature.detect.interest.GeneralToInterestMulti) GeneralFeatureDetector(boofcv.alg.feature.detect.interest.GeneralFeatureDetector) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) FactoryDescribeRegionPoint(boofcv.factory.feature.describe.FactoryDescribeRegionPoint) DetectDescribeMultiFusion(boofcv.abst.feature.detdesc.DetectDescribeMultiFusion) DetectorInterestPointMulti(boofcv.abst.feature.detect.interest.DetectorInterestPointMulti) GeneralFeatureIntensity(boofcv.abst.feature.detect.intensity.GeneralFeatureIntensity)

Aggregations

DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)7 FactoryDescribeRegionPoint (boofcv.factory.feature.describe.FactoryDescribeRegionPoint)6 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)3 DetectorInterestPointMulti (boofcv.abst.feature.detect.interest.DetectorInterestPointMulti)3 GeneralFeatureDetector (boofcv.alg.feature.detect.interest.GeneralFeatureDetector)3 PkltConfig (boofcv.alg.tracker.klt.PkltConfig)3 GrayF32 (boofcv.struct.image.GrayF32)3 AssociateDescription2D (boofcv.abst.feature.associate.AssociateDescription2D)2 ScoreAssociateHamming_B (boofcv.abst.feature.associate.ScoreAssociateHamming_B)2 DetectDescribeMulti (boofcv.abst.feature.detdesc.DetectDescribeMulti)2 DetectDescribeMultiFusion (boofcv.abst.feature.detdesc.DetectDescribeMultiFusion)2 ConfigExtract (boofcv.abst.feature.detect.extract.ConfigExtract)2 NonMaxSuppression (boofcv.abst.feature.detect.extract.NonMaxSuppression)2 GeneralFeatureIntensity (boofcv.abst.feature.detect.intensity.GeneralFeatureIntensity)2 GeneralToInterestMulti (boofcv.abst.feature.detect.interest.GeneralToInterestMulti)2 PointTracker (boofcv.abst.feature.tracker.PointTracker)2 PointTrackerToTwoPass (boofcv.abst.feature.tracker.PointTrackerToTwoPass)2 PointTrackerTwoPass (boofcv.abst.feature.tracker.PointTrackerTwoPass)2 FactoryInterestPoint (boofcv.factory.feature.detect.interest.FactoryInterestPoint)2 FactoryPointTracker (boofcv.factory.feature.tracker.FactoryPointTracker)2