Пример #1
0
 static void MaskMinutiae(List <MutableMinutia> minutiae, BooleanMatrix mask)
 {
     minutiae.RemoveAll(minutia =>
     {
         var arrow = (-Parameters.MaskDisplacement * DoubleAngle.ToVector(minutia.Direction)).Round();
         return(!mask.Get(minutia.Position + arrow, false));
     });
 }
Пример #2
0
        static ConsideredOrientation[][] PlanOrientations()
        {
            var random = new OrientationRandom();
            var splits = new ConsideredOrientation[Parameters.OrientationSplit][];

            for (int i = 0; i < Parameters.OrientationSplit; ++i)
            {
                var orientations = splits[i] = new ConsideredOrientation[Parameters.OrientationsChecked];
                for (int j = 0; j < Parameters.OrientationsChecked; ++j)
                {
                    var sample = orientations[j] = new ConsideredOrientation();
                    while (true)
                    {
                        double angle    = random.Next() * Math.PI;
                        double distance = Doubles.InterpolateExponential(Parameters.MinOrientationRadius, Parameters.MaxOrientationRadius, random.Next());
                        sample.Offset = (distance * DoubleAngle.ToVector(angle)).Round();
                        if (sample.Offset == IntPoint.Zero)
                        {
                            continue;
                        }
                        if (sample.Offset.Y < 0)
                        {
                            continue;
                        }
                        bool duplicate = false;
                        for (int jj = 0; jj < j; ++jj)
                        {
                            if (orientations[jj].Offset == sample.Offset)
                            {
                                duplicate = true;
                            }
                        }
                        if (duplicate)
                        {
                            continue;
                        }
                        break;
                    }
                    sample.Orientation = DoubleAngle.ToVector(DoubleAngle.Add(DoubleAngle.ToOrientation(DoubleAngle.Atan((DoublePoint)sample.Offset)), Math.PI));
                }
            }
            return(splits);
        }
Пример #3
0
        static IntPoint[][] OrientedLines(int resolution, int radius, double step)
        {
            var result = new IntPoint[resolution][];

            for (int orientationIndex = 0; orientationIndex < resolution; ++orientationIndex)
            {
                var line = new List <IntPoint>();
                line.Add(IntPoint.Zero);
                var direction = DoubleAngle.ToVector(DoubleAngle.FromOrientation(DoubleAngle.BucketCenter(orientationIndex, resolution)));
                for (double r = radius; r >= 0.5; r /= step)
                {
                    var sample = (r * direction).Round();
                    if (!line.Contains(sample))
                    {
                        line.Add(sample);
                        line.Add(-sample);
                    }
                }
                result[orientationIndex] = line.ToArray();
            }
            return(result);
        }