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);
}
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);
}
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);
}
}
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));
}
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));
}
Aggregations