Exemplo n.º 1
0
        private static void Extract(
            Minutiaes minutiaes,
            byte[] p,
            int i,
            int j,
            int offset,
            int stride,
            MinutiaeType type
            )
        {
            //p[offset + 0] = 250;
            //p[offset + 1] = 120;
            //p[offset + 2] = 0;

            if (minutiaes.ContainsKey(type))
            {
                minutiaes[type].Add((j / 3, i));
            }
            else
            {
                minutiaes[type] = new List <(int X, int Y)>()
                {
                    (j / 3, i)
                }
            };
        }
 public Minutiae(int x, int y, double angle, MinutiaeType type)
 {
     this.X          = x;
     this.Y          = y;
     this.Angle      = angle;
     this.Type       = type;
     this.IsMatching = false;
 }
Exemplo n.º 3
0
        public static Dictionary <Point, MinutiaeType> DetectMinutiae(WriteableBitmap bitmap)
        {
            Dictionary <Point, MinutiaeType> points = new Dictionary <Point, MinutiaeType>();

            using (BitmapContext context = bitmap.GetBitmapContext())
            {
                int width  = context.Width;
                int height = context.Height;

                int[] mask = new int[9];


                for (int x = 1; x < width - 1; ++x)
                {
                    for (int y = 1; y < height - 1; ++y)
                    {
                        if (PixelHelper.IsBlack(context, x, y))
                        {
                            mask[0] = PixelHelper.IsWhite(context, x, y + 1) ? 0 : 1;
                            mask[1] = PixelHelper.IsWhite(context, x - 1, y + 1) ? 0 : 1;
                            mask[2] = PixelHelper.IsWhite(context, x - 1, y) ? 0 : 1;
                            mask[3] = PixelHelper.IsWhite(context, x - 1, y - 1) ? 0 : 1;
                            mask[4] = PixelHelper.IsWhite(context, x, y - 1) ? 0 : 1;
                            mask[5] = PixelHelper.IsWhite(context, x + 1, y - 1) ? 0 : 1;
                            mask[6] = PixelHelper.IsWhite(context, x + 1, y) ? 0 : 1;
                            mask[7] = PixelHelper.IsWhite(context, x + 1, y + 1) ? 0 : 1;
                            mask[8] = mask[0];


                            MinutiaeType cn = CalculateCN(mask);
                            if (IsMinutiae(cn))
                            {
                                points.Add(new Point(x, y), cn);

                                if (cn == MinutiaeType.Point)
                                {
                                    PixelHelper.SetPixel(context, x, y, Colors.Red);
                                }
                                else if (cn == MinutiaeType.Ending)
                                {
                                    PixelHelper.SetPixel(context, x, y, Colors.Green);
                                }
                                else if (cn == MinutiaeType.Fork)
                                {
                                    PixelHelper.SetPixel(context, x, y, Colors.Yellow);
                                }
                                else if (cn == MinutiaeType.Crossing)
                                {
                                    PixelHelper.SetPixel(context, x, y, Colors.DeepPink);
                                }
                            }
                        }
                    }
                }
            }

            return(points);
        }
Exemplo n.º 4
0
 private static bool IsMinutiae(MinutiaeType CN) => CN != MinutiaeType.Invalid;
Exemplo n.º 5
0
 public Minutiae(int x, int y, MinutiaeType type)
 {
     X    = x;
     Y    = y;
     Type = type;
 }