Beispiel #1
0
        public Translation Matching(List <Minutiae> minutiaesOriginal, List <Minutiae> minutiaesScann)
        {
            for (int mi = 0; mi < minutiaesOriginal.Count; mi++)
            {
                for (int mj = 0; mj < minutiaesScann.Count; mj++)
                {
                    Minutiae m1 = minutiaesOriginal[mi];
                    Minutiae m2 = minutiaesScann[mj];
                    for (int t = 0; t < angles.Length; t++)
                    {
                        double theta = angles[t];

                        if (dd(m2.Angle + theta, m1.Angle) < thetaBase)
                        {
                            try
                            {
                                Vector2 position = GetOffset(m1, m2, theta);// CalculateNewPosition(m1, m2, theta);
                                int     x        = Convert.ToInt32(position.x);
                                int     y        = Convert.ToInt32(position.y);
                                int     tt       = Convert.ToInt32(theta);

                                Vote(x, y, tt);
                            }
                            catch (Exception e)
                            {
                                //Debug.Print(Convert.ToInt32(position.x) + " " + Convert.ToInt32(position.y) + " " + Convert.ToInt32(theta));
                            }
                        }
                    }
                }
            }

            return(GetTranslation());
        }
Beispiel #2
0
        private Vector2 GetOffset(Minutiae m1, Minutiae m2, double angle)
        {
            double offsetX = m1.X - (Math.Cos(angle) * m2.X - Math.Sin(angle) * m2.Y);
            double offsetY = m1.Y - (Math.Sin(angle) * m2.X + Math.Cos(angle) * m2.Y);

            return(new Vector2(offsetX, offsetY));
        }
 private static bool Overlap(Minutiae m1, Minutiae m2)
 {
     if (m1.Compare(m2))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public static TranslationVotes Matching(List <Minutiae> minutiaesOriginal, List <Minutiae> minutiaesScann)
        {
            InitAnglesArray(10);
            for (int mi = 0; mi < minutiaesOriginal.Count; mi++)
            {
                for (int mj = 0; mj < minutiaesScann.Count; mj++)
                {
                    Minutiae m1 = minutiaesOriginal[mi];
                    Minutiae m2 = minutiaesScann[mj];
                    for (int t = 0; t < anglesArray.Length; t++)
                    {
                        double theta = anglesArray[t];

                        if (dd(m2.Angle + theta, m1.Angle) < theta_base)
                        {
                            Vector2 position = CalculateNewPosition(m1, m2, theta);
                            try
                            {
                                int x  = Convert.ToInt32(position.x);
                                int y  = Convert.ToInt32(position.y);
                                int tt = Convert.ToInt32(theta);

                                if (IsInside(x, y, tt))
                                {
                                    accumulator[x, y, tt]++;
                                    VoteNeighberhood(x, y, tt);
                                }
                            }
                            catch (Exception e)
                            {
                                Debug.Print(Convert.ToInt32(position.x) + " " + Convert.ToInt32(position.y) + " " + Convert.ToInt32(theta));
                            }
                        }
                    }
                }
            }

            Translation coordinate = FindOptimalTransformationInAccumulator();

            return(new TranslationVotes(coordinate.Y, coordinate.X, coordinate.T));
        }
        private static Vector2 CalculateNewPosition(Minutiae m1, Minutiae m2, double t)
        {
            Matrix <double> matrixI = Matrix <double> .Build.Dense(2, 1);

            Matrix <double> matrixAngle = Matrix <double> .Build.Dense(2, 2);

            Matrix <double> matrixJ = Matrix <double> .Build.Dense(2, 1);

            matrixI[0, 0] = m2.X; //m1
            matrixI[1, 0] = m2.Y;
            matrixJ[0, 0] = m1.X;
            matrixJ[1, 0] = m1.Y;

            matrixAngle[0, 0] = Math.Cos(t);
            matrixAngle[1, 0] = -Math.Sin(t);
            matrixAngle[0, 1] = Math.Sin(t);
            matrixAngle[1, 1] = Math.Cos(t);

            Matrix <double> multiplyMatrix = matrixAngle.Multiply(matrixJ);
            Matrix <double> result         = matrixI.Subtract(multiplyMatrix);

            return(new Vector2(Math.Round(result[0, 0]), Math.Round(result[1, 0])));
        }
        private void wykryjMinucjeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Image <Bgr, Byte> newImg = Minutiae.detectingMinutiae(imageAfterKMM);

            imageBox2.Image = newImg;
        }