Search in sources :

Example 1 with DescribePointRadiusAngle

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

the class CompareConvertedDescriptionsApp method main.

public static void main(String[] args) {
    String file1 = UtilIO.pathExample("stitch/kayak_01.jpg");
    String file2 = UtilIO.pathExample("stitch/kayak_02.jpg");
    InterestPointDetector<GrayF32> detector = FactoryInterestPoint.fastHessian(new ConfigFastHessian(1, 10, -1, 2, 9, 4, 4), GrayF32.class);
    DescribePointRadiusAngle<GrayF32, TupleDesc_F64> describeA = (DescribePointRadiusAngle) FactoryDescribePointRadiusAngle.surfStable(null, GrayF32.class);
    ConvertTupleDesc<TupleDesc_F64, TupleDesc_S8> converter = FactoryConvertTupleDesc.real_F64_S8(describeA.createDescription().size());
    DescribePointRadiusAngle<GrayF32, TupleDesc_S8> describeB = new DescribePointRadiusAngleConvertTuple<>(describeA, converter);
    ScoreAssociation<TupleDesc_F64> scoreA = FactoryAssociation.scoreSad(TupleDesc_F64.class);
    ScoreAssociation<TupleDesc_S8> scoreB = FactoryAssociation.scoreSad(TupleDesc_S8.class);
    BufferedImage image1 = Objects.requireNonNull(UtilImageIO.loadImage(file1));
    BufferedImage image2 = Objects.requireNonNull(UtilImageIO.loadImage(file2));
    visualize("Original", image1, image2, detector, describeA, scoreA);
    visualize("Modified", image1, image2, detector, describeB, scoreB);
    System.out.println("Done");
}
Also used : TupleDesc_S8(boofcv.struct.feature.TupleDesc_S8) ConfigFastHessian(boofcv.abst.feature.detect.interest.ConfigFastHessian) TupleDesc_F64(boofcv.struct.feature.TupleDesc_F64) DescribePointRadiusAngleConvertTuple(boofcv.abst.feature.describe.DescribePointRadiusAngleConvertTuple) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) GrayF32(boofcv.struct.image.GrayF32) DescribePointRadiusAngle(boofcv.abst.feature.describe.DescribePointRadiusAngle) FactoryDescribePointRadiusAngle(boofcv.factory.feature.describe.FactoryDescribePointRadiusAngle)

Example 2 with DescribePointRadiusAngle

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

the class ExampleDetectDescribe method createFromComponents.

/**
 * Any arbitrary implementation of InterestPointDetector, OrientationImage, DescribeRegionPoint
 * can be combined into DetectDescribePoint. The syntax is more complex, but the end result is more flexible.
 * This should only be done if there isn't a pre-made DetectDescribePoint.
 */
public static <T extends ImageGray<T>, TD extends TupleDesc<TD>> DetectDescribePoint<T, TD> createFromComponents(Class<T> imageType) {
    // create a corner detector
    Class derivType = GImageDerivativeOps.getDerivativeType(imageType);
    GeneralFeatureDetector corner = FactoryDetectPoint.createShiTomasi(new ConfigGeneralDetector(1000, 5, 1), null, derivType);
    InterestPointDetector detector = FactoryInterestPoint.wrapPoint(corner, 1, imageType, derivType);
    // describe points using BRIEF
    DescribePointRadiusAngle describe = FactoryDescribePointRadiusAngle.brief(new ConfigBrief(true), imageType);
    // NOTE: orientation will not be estimated
    return FactoryDetectDescribe.fuseTogether(detector, null, describe);
}
Also used : ConfigBrief(boofcv.abst.feature.describe.ConfigBrief) InterestPointDetector(boofcv.abst.feature.detect.interest.InterestPointDetector) GeneralFeatureDetector(boofcv.alg.feature.detect.interest.GeneralFeatureDetector) DescribePointRadiusAngle(boofcv.abst.feature.describe.DescribePointRadiusAngle) FactoryDescribePointRadiusAngle(boofcv.factory.feature.describe.FactoryDescribePointRadiusAngle) ConfigGeneralDetector(boofcv.abst.feature.detect.interest.ConfigGeneralDetector)

Example 3 with DescribePointRadiusAngle

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

the class TestDetectDescribeFusion method checkFeatureNotInBounds.

/**
 * If a feature is not in bounds make sure everything is handled correctly
 */
@Test
void checkFeatureNotInBounds() {
    InterestPointDetector detector = new DummyDetector();
    DescribePointRadiusAngle describe = new DummyRegionPoint();
    DetectDescribeFusion alg = new DetectDescribeFusion(detector, null, describe);
    alg.detect(new GrayF32(2, 2));
    // one feature should not be inside the image
    assertEquals(9, alg.getNumberOfFeatures());
    for (int i = 0; i < 9; i++) {
        assertEquals(2, alg.getRadius(i), 1e-8);
        assertEquals(1, alg.getOrientation(i), 1e-8);
        assertTrue(alg.getDescription(i) != null);
        assertTrue(alg.getLocation(i) != null);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) InterestPointDetector(boofcv.abst.feature.detect.interest.InterestPointDetector) DescribePointRadiusAngle(boofcv.abst.feature.describe.DescribePointRadiusAngle) FactoryDescribePointRadiusAngle(boofcv.factory.feature.describe.FactoryDescribePointRadiusAngle) FactoryInterestPoint(boofcv.factory.feature.detect.interest.FactoryInterestPoint) Test(org.junit.jupiter.api.Test)

Example 4 with DescribePointRadiusAngle

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

the class TestDescribePlanar method various.

@Test
void various() {
    DescribePointRadiusAngle[] 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, 3));
    alg.process(0, 1, 2, 3, alg.createDescription());
    assertEquals(30, alg.createDescription().size());
    assertEquals(1, alg.numCombined);
    for (int i = 0; i < 3; i++) {
        assertEquals(1, ((DummyDesc) descs[i]).numProcess);
    }
}
Also used : GrayS8(boofcv.struct.image.GrayS8) DescribePointRadiusAngle(boofcv.abst.feature.describe.DescribePointRadiusAngle) Planar(boofcv.struct.image.Planar) Test(org.junit.jupiter.api.Test)

Aggregations

DescribePointRadiusAngle (boofcv.abst.feature.describe.DescribePointRadiusAngle)4 FactoryDescribePointRadiusAngle (boofcv.factory.feature.describe.FactoryDescribePointRadiusAngle)3 InterestPointDetector (boofcv.abst.feature.detect.interest.InterestPointDetector)2 GrayF32 (boofcv.struct.image.GrayF32)2 Test (org.junit.jupiter.api.Test)2 ConfigBrief (boofcv.abst.feature.describe.ConfigBrief)1 DescribePointRadiusAngleConvertTuple (boofcv.abst.feature.describe.DescribePointRadiusAngleConvertTuple)1 ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)1 ConfigGeneralDetector (boofcv.abst.feature.detect.interest.ConfigGeneralDetector)1 GeneralFeatureDetector (boofcv.alg.feature.detect.interest.GeneralFeatureDetector)1 FactoryInterestPoint (boofcv.factory.feature.detect.interest.FactoryInterestPoint)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)1 TupleDesc_S8 (boofcv.struct.feature.TupleDesc_S8)1 GrayS8 (boofcv.struct.image.GrayS8)1 Planar (boofcv.struct.image.Planar)1 BufferedImage (java.awt.image.BufferedImage)1