RansacHomographyEstimator Class |
Namespace: Accord.Imaging
The RansacHomographyEstimator type exposes the following members.
Name | Description | |
---|---|---|
RansacHomographyEstimator |
Creates a new RANSAC homography estimator.
|
Name | Description | |
---|---|---|
Inliers |
Gets the final set of inliers detected by RANSAC.
| |
Ransac |
Gets the RANSAC estimator used.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Estimate(PointF) |
Matches two sets of points using RANSAC.
| |
Estimate(IntPoint) |
Matches two sets of points using RANSAC.
| |
Estimate(Point) |
Matches two sets of points using RANSAC.
| |
Estimate(PointF, PointF) |
Matches two sets of points using RANSAC.
| |
Estimate(IntPoint, IntPoint) |
Matches two sets of points using RANSAC.
| |
Estimate(Point, Point) |
Matches two sets of points using RANSAC.
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
Fitting a homography using RANSAC is pretty straightforward. Being a iterative method, in a single iteration a random sample of four correspondences is selected from the given correspondence points and a homography H is then computed from those points.
The original points are then transformed using this homography and their distances to where those transforms should be is then computed and matching points can classified as inliers and non-matching points as outliers.
After a given number of iterations, the iteration which produced the largest number of inliers is then selected as the best estimation for H.
References:
// Let's start with two pictures that have been // taken from slightly different points of view: // Bitmap img1 = Resources.dc_left; Bitmap img2 = Resources.dc_right; // Those pictures are shown below: ImageBox.Show(img1, PictureBoxSizeMode.Zoom, 640, 480); ImageBox.Show(img2, PictureBoxSizeMode.Zoom, 640, 480);
// Step 1: Detect feature points using Surf Corners Detector var surf = new SpeededUpRobustFeaturesDetector(); var points1 = surf.ProcessImage(img1); var points2 = surf.ProcessImage(img2); // Step 2: Match feature points using a k-NN var matcher = new KNearestNeighborMatching(5); var matches = matcher.Match(points1, points2); // Step 3: Create the matrix using a robust estimator var ransac = new RansacHomographyEstimator(0.001, 0.99); MatrixH homographyMatrix = ransac.Estimate(matches); // Step 4: Project and blend using the homography Blend blend = new Blend(homographyMatrix, img1); // Compute the blending algorithm Bitmap result = blend.Apply(img2); // Show on screen ImageBox.Show(result, PictureBoxSizeMode.Zoom, 640, 480);
The resulting image is shown below.