public override ICData Run()
        {
            Size CommonCanvasSize = new Size(Math.Max(m_Image1.Width, m_Image2.Width), Math.Max(m_Image1.Height, m_Image2.Height));

            m_BinaryMap1 = Utilities.ToBinaryMap(m_Image1, TresholdColor, CommonCanvasSize);
            m_BinaryMap2 = Utilities.ToBinaryMap(m_Image2, TresholdColor, CommonCanvasSize);

            HausdorffMatching matching = new HausdorffMatching(m_BinaryMap1, m_BinaryMap2);
            m_Result = matching.CalculateTwoSides();

            return new HausdorffMatchingResult(matching.ResultMap1, matching.ResultMap2, m_Result);
        }
        public override ICData Run()
        {
            Size StartingCommonSize = new Size(Math.Max(m_Image1.Width, m_Image2.Width), Math.Max(m_Image1.Height, m_Image2.Height));
            //Preparing structures
            List<Point> sourcePoints = Utilities.ExtractPoints(m_Image1, TresholdColor);
            List<Point> targetPoints = Utilities.ExtractPoints(m_Image2, TresholdColor);

            DoubleMatrix source = Utilities.ListToMatrix(sourcePoints);
            DoubleMatrix target = Utilities.ListToMatrix(targetPoints);

            //1st station, PCA alignment
            ////////////////////////////
            PCAMatching pcaMatching = new PCAMatching(source, target);
            pcaMatching.Calculate();

            target = pcaMatching.Result;

            //In between stages
            DoubleMatrix minMax = PCA.Utils.ShiftToPositives(ref target, source);
            minMax              = PCA.Utils.ShiftToPositives(ref source, target);

            sourcePoints = Utilities.MatrixToList(source);
            targetPoints = Utilities.MatrixToList(target);

            m_sourcePtArray = sourcePoints.ToArray();
            m_targetPtArray = targetPoints.ToArray();

            Size meshSize = new Size(
                Math.Max((int)Math.Ceiling(minMax[sr_X, sr_MaxCol] + 2), StartingCommonSize.Width),
                Math.Max((int)Math.Ceiling(minMax[sr_Y, sr_MaxCol] + 2), StartingCommonSize.Height));

            //2nd station,Hausdorff Matching Points insertion
            //////////////////////////////////////////////////
            IntMatrix sourceBinaryMap = Utilities.ToBinaryMap(source,meshSize);
            IntMatrix targetBinaryMap = Utilities.ToBinaryMap(target,meshSize);

            HausdorffMatching hausdorffMatching = new HausdorffMatching(sourceBinaryMap, targetBinaryMap);
            IntMatrix diffSource = hausdorffMatching.Calculate1on2();
            IntMatrix diffTarget = hausdorffMatching.Calculate2on1();

            //Preparing a logic for point selection bank
            List<Point> currList = null;
            Func<int, int, int, int> pointInsertionLogic = (row, col, value) =>
                {
                    for (int i = 2; i < value; ++i)
                    {
                        currList.Add(new Point(col, row));
                    }
                    return value;
                };

            //Applying this logic
            m_SourceBank = new List<Point>();
            currList = m_SourceBank;
            diffSource.Iterate(pointInsertionLogic);
            m_TargetBank = new List<Point>();
            currList = m_TargetBank;
            diffTarget.Iterate(pointInsertionLogic);

            //3rd station ShapeContext Matching
            ///////////////////////////////////
            ShapeContextMatching shapeContextMatching = new ShapeContextMatching(m_sourcePtArray, m_targetPtArray, meshSize, SelectSamplesLogic);

            shapeContextMatching.AlignmentLogic = shapeContextMatching.StandardAlignmentLogic;
            if (ShapeContextWarpDistanceTreshold > 0)
            {
                shapeContextMatching.DistanceTreshold = ShapeContextWarpDistanceTreshold;
            }
            shapeContextMatching.Calculate();

            CShapeContextResultData retResult =
                new CShapeContextResultData(
                    m_sourcePtArray,
                    m_targetPtArray,
                    meshSize,
                    shapeContextMatching.LastSourceSamples,
                    shapeContextMatching.LastTargetSamples);

            return retResult;
        }