Accord.Imaging.Tools.Normalize C# (CSharp) Method

Normalize() public static method

Normalizes a set of homogeneous points so that the origin is located at the centroid and the mean distance to the origin is sqrt(2).
public static Normalize ( this points, MatrixH &transformation ) : System.Drawing.PointF[]
points this
transformation MatrixH
return System.Drawing.PointF[]
        public static PointF[] Normalize(this PointF[] points, out MatrixH transformation)
        {
            float[,] H;
            var result = Normalize(points, out H);
            transformation = new MatrixH(H);
            return result;
        }

Same methods

Tools::Normalize ( this points, float &transformation ) : System.Drawing.PointF[]
Tools::Normalize ( this points, MatrixH &transformation ) : Accord.Imaging.PointH[]
Tools::Normalize ( this points, float &transformation ) : Accord.Imaging.PointH[]

Usage Example

Example #1
0
        /// <summary>
        ///   Matches two sets of points using RANSAC.
        /// </summary>
        ///
        /// <returns>The homography matrix matching x1 and x2.</returns>
        ///
        public MatrixH Estimate(PointF[] points1, PointF[] points2)
        {
            // Initial argument checks
            if (points1.Length != points2.Length)
            {
                throw new ArgumentException("The number of points should be equal.");
            }

            if (points1.Length < 4)
            {
                throw new ArgumentException("At least four points are required to fit an homography");
            }


            // Normalize each set of points so that the origin is
            //  at centroid and mean distance from origin is sqrt(2).
            MatrixH T1, T2;

            this.pointSet1 = Tools.Normalize(points1, out T1);
            this.pointSet2 = Tools.Normalize(points2, out T2);
            d2             = new double[points1.Length];


            // Compute RANSAC and find the inlier points
            MatrixH H = ransac.Compute(points1.Length, out inliers);

            if (inliers == null || inliers.Length < 4)
            {
                //throw new Exception("RANSAC could not find enough points to fit an homography.");
                return(null);
            }


            // Compute the final homography considering all inliers
            H = homography(inliers);

            // Denormalize
            H = T2.Inverse() * (H * T1);

            return(H);
        }
All Usage Examples Of Accord.Imaging.Tools::Normalize