예제 #1
0
 private static double ManyLowQualityBlocksFunction(double x)
 {
     if (x < 22)
     {
         return(0);
     }
     if (x >= 22 && x < 25)
     {
         return(3 * Math.Sqrt(Math.PI * 2) * Gaussian.Gaussian1D(-x + 25, 3));
     }
     return(1);
 }
예제 #2
0
 private static double LittleLowQualityBlocksFunction(double x)
 {
     if (x < 22)
     {
         return(1);
     }
     if (x >= 22 && x < 26)
     {
         return(3 * Math.Sqrt(Math.PI * 2) * Gaussian.Gaussian1D((x - 22), 3));
     }
     return(0);
 }
예제 #3
0
        private static double GetSpatialContribution(Minutia m, Tuple <int, int> currentCell)
        {
            double distance = GetDistance(m.X, m.Y, currentCell.Item1, currentCell.Item2);

            return(Gaussian.Gaussian1D(distance, Constants.SigmaS));
        }
 private double GaussianLocation(Minutia minutia, PointF point)
 {
     return(Gaussian.Gaussian1D(VectorHelper.PointDistance(new PointF(minutia.X, minutia.Y), point),
                                SigmaLocation));
 }
        private static void DirectionFiltering(double[,] l1, Complex[,] ls, double tau1, double tau2)
        {
            var l1Copy = new double[l1.GetLength(0), l1.GetLength(1)];

            for (int x = 0; x < l1.GetLength(0); x++)
            {
                for (int y = 0; y < l1.GetLength(1); y++)
                {
                    l1Copy[x, y] = l1[x, y];
                }
            }

            var kernel = new double[directionSize];
            var ksum   = 0d;

            for (int i = 0; i < directionSize; i++)
            {
                ksum += kernel[i] = Gaussian.Gaussian1D(i - directionSize / 2, sigmaDirection);
            }

            for (int i = 0; i < directionSize; i++)
            {
                kernel[i] /= ksum;
            }
            for (int x = 0; x < l1.GetLength(0); x++)
            {
                for (int y = 0; y < l1.GetLength(1); y++)
                {
                    if (ls[x, y].Magnitude < tau1)
                    {
                        l1[x, y] = 0;
                    }
                    else
                    {
                        double sum  = 0;
                        int    area = 0;
                        for (int dx = -ringOuterRadius; dx <= ringOuterRadius; dx++)
                        {
                            for (int dy = -ringOuterRadius; dy <= ringOuterRadius; dy++)
                            {
                                if (Math.Abs(dy) < ringInnerRadius || Math.Abs(dx) < ringInnerRadius)
                                {
                                    continue;
                                }
                                int xx = x + dx;
                                if (xx < 0)
                                {
                                    xx = 0;
                                }
                                if (xx >= l1.GetLength(0))
                                {
                                    xx = l1.GetLength(0) - 1;
                                }
                                int yy = y + dy;
                                if (yy < 0)
                                {
                                    yy = 0;
                                }
                                if (yy >= l1.GetLength(1))
                                {
                                    yy = l1.GetLength(1) - 1;
                                }
                                sum += ls[xx, yy].Magnitude;
                                area++;
                            }
                        }
                        if (sum / area < tau2)
                        {
                            l1[x, y] = 0;
                        }
                        else
                        {
                            var phase = ls[x, y].Phase / 2 - Math.PI / 2;
                            if (phase > Math.PI * 39 / 40)
                            {
                                phase -= Math.PI;
                            }
                            if (phase < -Math.PI / 40)
                            {
                                phase += Math.PI;
                            }
                            var direction = (int)Math.Round(phase / (Math.PI / 20));

                            var avg = 0.0d;
                            for (int i = 0; i < directionSize; i++)
                            {
                                var p  = directions[i, direction];
                                int xx = x + p.X;
                                if (xx < 0)
                                {
                                    xx = 0;
                                }
                                if (xx >= l1.GetLength(0))
                                {
                                    xx = l1.GetLength(0) - 1;
                                }
                                int yy = y - p.Y;
                                if (yy < 0)
                                {
                                    yy = 0;
                                }
                                if (yy >= l1.GetLength(1))
                                {
                                    yy = l1.GetLength(1) - 1;
                                }
                                avg += kernel[i] * l1Copy[xx, yy];
                            }
                            l1[x, y] = avg;
                        }
                    }
                }
            }
        }