예제 #1
0
            private float ComputeErrorAfterTransform(CorrespondenceCollection correspondences,
                                                     Transform originalTransform, Transform currentTransform,
                                                     AggregationMethods.AggregationMethod aggregationMethod)
            {
                //Apply the newTransform to the model points
                List <Point> modelPoints = TransformPoints(correspondences.ModelPoints, originalTransform, currentTransform);

                //Normalize the points if required
                Matrix4x4 normalizationMatrix = Matrix4x4.identity;

                if (configuration.NormalizePoints)
                {
                    normalizationMatrix = new PointNormalizer().ComputeNormalizationMatrix(modelPoints, correspondences.StaticPoints);
                }

                //Compute the correspondence errors
                List <float> errors = ComputeCorrespondenceErrors(
                    normalizationMatrix,
                    modelPoints: modelPoints,
                    staticPoints: correspondences.StaticPoints
                    );

                //Always use the mean of the errors for the termination error to
                // ensure that the number of correspondences does not influence the error
                float error = aggregationMethod(errors);

                return(error);
            }
예제 #2
0
            public float ComputeInitialError(CorrespondenceCollection correspondences)
            {
                Matrix4x4 normalizationMatrix = Matrix4x4.identity;

                if (configuration.NormalizePoints)
                {
                    normalizationMatrix = new PointNormalizer().ComputeNormalizationMatrix(correspondences.ModelPoints, correspondences.StaticPoints);
                }

                List <float> errors = ComputeCorrespondenceErrors(
                    normalizationMatrix,
                    modelPoints: correspondences.ModelPoints,
                    staticPoints: correspondences.StaticPoints
                    );

                //Aggregate the errors, use mean to ensure that the number of correspondences does not influence the error
                float error = AggregationMethods.Mean(errors);

                return(error);
            }
예제 #3
0
 public void Init()
 {
     normalizer = new PointNormalizer();
 }