use of boofcv.gui.feature.AssociationPanel in project BoofCV by lessthanoptimal.
the class ExampleAssociatePoints method associate.
/**
* Detect and associate point features in the two images. Display the results.
*/
public void associate(BufferedImage imageA, BufferedImage imageB) {
T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType);
T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType);
// stores the location of detected interest points
pointsA = new ArrayList<>();
pointsB = new ArrayList<>();
// stores the description of detected interest points
DogArray<TD> descA = UtilFeature.createArray(detDesc, 100);
DogArray<TD> descB = UtilFeature.createArray(detDesc, 100);
// describe each image using interest points
describeImage(inputA, pointsA, descA);
describeImage(inputB, pointsB, descB);
// Associate features between the two images
associate.setSource(descA);
associate.setDestination(descB);
associate.associate();
// display the results
AssociationPanel panel = new AssociationPanel(20);
panel.setAssociation(pointsA, pointsB, associate.getMatches());
panel.setImages(imageA, imageB);
ShowImages.showWindow(panel, "Associated Features", true);
}
use of boofcv.gui.feature.AssociationPanel in project BoofCV by lessthanoptimal.
the class ExampleComputeFundamentalMatrix method main.
public static void main(String[] args) {
String dir = UtilIO.pathExample("structure/");
BufferedImage imageA = UtilImageIO.loadImage(dir, "undist_cyto_01.jpg");
BufferedImage imageB = UtilImageIO.loadImage(dir, "undist_cyto_02.jpg");
List<AssociatedPair> matches = computeMatches(imageA, imageB);
// Where the fundamental matrix is stored
DMatrixRMaj F;
// List of matches that matched the model
List<AssociatedPair> inliers = new ArrayList<>();
// estimate and print the results using a robust and simple estimator
// The results should be difference since there are many false associations in the simple model
// Also note that the fundamental matrix is only defined up to a scale factor.
F = robustFundamental(matches, inliers, 0.5);
System.out.println("Robust");
// scale to make comparision easier
CommonOps_DDRM.divide(F, NormOps_DDRM.normF(F));
F.print();
F = simpleFundamental(matches);
System.out.println("Simple");
CommonOps_DDRM.divide(F, NormOps_DDRM.normF(F));
F.print();
// display the inlier matches found using the robust estimator
var panel = new AssociationPanel(20);
panel.setAssociation(inliers);
panel.setImages(imageA, imageB);
ShowImages.showWindow(panel, "Inlier Pairs");
}
use of boofcv.gui.feature.AssociationPanel in project BoofCV by lessthanoptimal.
the class ExampleStereoTwoViewsOneCamera method drawInliers.
/**
* Draw inliers for debugging purposes. Need to convert from normalized to pixel coordinates.
*/
public static void drawInliers(BufferedImage left, BufferedImage right, CameraPinholeBrown intrinsic, List<AssociatedPair> normalized) {
Point2Transform2_F64 n_to_p = LensDistortionFactory.narrow(intrinsic).distort_F64(false, true);
List<AssociatedPair> pixels = new ArrayList<>();
for (AssociatedPair n : normalized) {
AssociatedPair p = new AssociatedPair();
n_to_p.compute(n.p1.x, n.p1.y, p.p1);
n_to_p.compute(n.p2.x, n.p2.y, p.p2);
pixels.add(p);
}
// display the results
AssociationPanel panel = new AssociationPanel(20);
panel.setAssociation(pixels);
panel.setImages(left, right);
ShowImages.showWindow(panel, "Inlier Features", true);
}
Aggregations