Esempio n. 1
0
 /// <summary>
 /// Creating a matching object based on two sets of points.
 /// </summary>
 /// <param name="i_Source">2 x M1 points the first row is the X value, the second is the Y value</param>
 /// <param name="i_Target">2 x M2 points the first row is the X value, the second is the Y value</param>
 public PCAMatching(DoubleMatrix i_Source, DoubleMatrix i_Target)
 {
     if (i_Source.RowsCount != i_Target.RowsCount)
     {
         throw new PCAException("Cannot match between two sets with different dimensions");
     }
     m_SourceTransform = new PCAtransform(i_Source);
     m_TargetTransform = new PCAtransform(i_Target);
 }
Esempio n. 2
0
        private void normalize(PCAtransform i_SourceTransform, PCAtransform i_TargetTransform)
        {
            double angle    = AngleFromSource;
            double scaleByX = Math.Sqrt(i_SourceTransform.EigenValues[sr_X] / i_TargetTransform.EigenValues[sr_X]);
            //Two options of taking scale factor of the axis:
            //i_SourceTransform.AverageByDimension[sr_X, 0] / i_TargetTransform.AverageByDimension[sr_X, 0];
            //i_SourceTransform.EigenValues[sr_X] / i_TargetTransform.EigenValues[sr_X];
            double scaleByY = Math.Sqrt(i_SourceTransform.EigenValues[sr_Y] / i_TargetTransform.EigenValues[sr_Y]);

            //Two options of taking scale factor of the axis:
            //i_SourceTransform.AverageByDimension[sr_Y, 0] / i_TargetTransform.AverageByDimension[sr_Y, 0];
            //i_SourceTransform.EigenValues[sr_Y] / i_TargetTransform.EigenValues[sr_Y];

            m_ResultTarget = translate(i_TargetTransform.CenteredPoints, angle, scaleByX, scaleByY);
            Utils.AddScalarsByDims(ref m_ResultTarget, i_SourceTransform.AverageByDimension);
            DoubleMatrix sourcePoints = i_SourceTransform.CenteredPoints;

            Utils.AddScalarsByDims(ref sourcePoints, i_SourceTransform.AverageByDimension);
        }
Esempio n. 3
0
 /// <summary>
 /// Creating a matching object based on two sets of points.
 /// </summary>
 /// <param name="i_Source">2 x M1 points the first row is the X value, the second is the Y value</param>
 /// <param name="i_Target">2 x M2 points the first row is the X value, the second is the Y value</param>
 public PCAMatching(DoubleMatrix i_Source, DoubleMatrix i_Target)
 {
     if (i_Source.RowsCount != i_Target.RowsCount)
     {
         throw new PCAException("Cannot match between two sets with different dimensions");
     }
     m_SourceTransform = new PCAtransform(i_Source);
     m_TargetTransform = new PCAtransform(i_Target);
 }
Esempio n. 4
0
        private void normalize(PCAtransform i_SourceTransform, PCAtransform i_TargetTransform)
        {
            double angle = AngleFromSource;
            double scaleByX = Math.Sqrt(i_SourceTransform.EigenValues[sr_X] / i_TargetTransform.EigenValues[sr_X]);
            //Two options of taking scale factor of the axis:
                //i_SourceTransform.AverageByDimension[sr_X, 0] / i_TargetTransform.AverageByDimension[sr_X, 0];
                //i_SourceTransform.EigenValues[sr_X] / i_TargetTransform.EigenValues[sr_X];
            double scaleByY = Math.Sqrt(i_SourceTransform.EigenValues[sr_Y] / i_TargetTransform.EigenValues[sr_Y]);
            //Two options of taking scale factor of the axis:
                //i_SourceTransform.AverageByDimension[sr_Y, 0] / i_TargetTransform.AverageByDimension[sr_Y, 0];
                //i_SourceTransform.EigenValues[sr_Y] / i_TargetTransform.EigenValues[sr_Y];

            m_ResultTarget = translate(i_TargetTransform.CenteredPoints, angle, scaleByX, scaleByY);
            Utils.AddScalarsByDims(ref m_ResultTarget, i_SourceTransform.AverageByDimension);
            DoubleMatrix sourcePoints = i_SourceTransform.CenteredPoints;
            Utils.AddScalarsByDims(ref sourcePoints, i_SourceTransform.AverageByDimension);
        }