Exemplo n.º 1
0
 public static byte[] ConvertWSQToBmp(WsqImage wsq)
 {
     _wsqImg = new gxImage();
     _wsqImg.Create(wsq.PixelFormat, wsq.XSize, wsq.YSize, 0);
     _wsqImg.xres(wsq.XRes);
     _wsqImg.yres(wsq.YRes);
     _wsqImg.LoadFromMem(wsq.Content, wsq.PixelFormat);
     return _wsqImg.SaveToMem((int)GX_IMGFILEFORMATS.GX_BMP);
 }
Exemplo n.º 2
0
    public int fpsGetFingersImages(int handAndFingerMask, bool saveFingerAsFile)
    {
        try
        {
            if (_arrayOfBMP != null) { _arrayOfBMP.Clear(); _arrayOfBMP = null; }
            if (_arrayOfWSQ != null) { _arrayOfWSQ.Clear(); _arrayOfWSQ = null; }

            /* Search Finger */
            int reqid, stat;

            /* Clears internal stored finger buffers */
            _fps.ResetFingerList();

            /* Starts an asynchronous capture process
            // params: time in usec, quality in per-thousand, mode of live scan, fingerlist
            //
            // The finger list has the format 0hhh 0000 iiii mmmm rrrr llll tttt ssss
            //	h - scan object: 001 left hand, 010 right hand, 011 same fingers of both hands
            //	i - index finger	|
            //	m - middle finger	|
            //	r - ring finger		|--> value of FPS_PRESENCE   FPS_AVAILABLE = 3
            //	l - little finger	|
            //	t - left thumb		|
            //	s - right thumb		|
            */

            int color = (int)FPS_STATUS_LED_COLOR.FPS_SLC_OFF;
            int index = 0;
            int middle = 0;
            int ring = 0;
            int little = 0;
            string wsqIndexFileName = String.Empty;
            string wsqMiddleFileName = String.Empty;
            string wsqRingFileName = String.Empty;
            string wsqLittleFileName = String.Empty;

            _fps.SetStatusLed(0xff, color); // off
            color = (int)FPS_STATUS_LED_COLOR.FPS_SLC_GREEN;

            int fingerMask = 0x00;
            switch (handAndFingerMask & 0xff000000)
            {
                case 0x10000000:    //0x10333300    left hand
                case 0x20000000:    //0x20333300    right hand
                    fingerMask |= (handAndFingerMask & 0x00300000) != 0 ? 0x08 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00030000) != 0 ? 0x04 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00003000) != 0 ? 0x02 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00000300) != 0 ? 0x01 : 0x00;
                    break;
                case 0x30000000:    //0x20000033    thumbs
                    fingerMask |= (handAndFingerMask & 0x00000030) != 0 ? 0x04 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00000003) != 0 ? 0x02 : 0x00;
                    break;
            }

            int lampMask = fingerMask;
            switch (handAndFingerMask & 0xff000000)
            {
                case 0x10000000:    //0x10333300  left hand
                    index = (int)FPS_POSITION.FPS_POS_LEFT_INDEX;
                    middle = (int)FPS_POSITION.FPS_POS_LEFT_MIDDLE;
                    ring = (int)FPS_POSITION.FPS_POS_LEFT_RING;
                    little = (int)FPS_POSITION.FPS_POS_LEFT_LITTLE;
                    wsqIndexFileName = "lindex.wsq";
                    wsqMiddleFileName = "lmiddle.wsq";
                    wsqRingFileName = "lring.wsq";
                    wsqLittleFileName = "llittle.wsq";
                    lampMask = 0x80;
                    lampMask |= (fingerMask & 0x00000001) != 0 ? 0x08 : 0x00;
                    lampMask |= (fingerMask & 0x00000002) != 0 ? 0x04 : 0x00;
                    lampMask |= (fingerMask & 0x00000004) != 0 ? 0x02 : 0x00;
                    lampMask |= (fingerMask & 0x00000008) != 0 ? 0x01 : 0x00;
                    break;
                case 0x20000000:    //0x20333300
                    index = (int)FPS_POSITION.FPS_POS_RIGHT_INDEX;
                    middle = (int)FPS_POSITION.FPS_POS_RIGHT_MIDDLE;
                    ring = (int)FPS_POSITION.FPS_POS_RIGHT_RING;
                    little = (int)FPS_POSITION.FPS_POS_RIGHT_LITTLE;
                    wsqIndexFileName = "rindex.wsq";
                    wsqMiddleFileName = "rmiddle.wsq";
                    wsqRingFileName = "rring.wsq";
                    wsqLittleFileName = "rlittle.wsq";
                    lampMask |= 0x40;
                    break;
                case 0x30000000:    //0x30000033
                    middle = (int)FPS_POSITION.FPS_POS_LEFT_THUMB;
                    ring = (int)FPS_POSITION.FPS_POS_RIGHT_THUMB;
                    wsqMiddleFileName = "lthumb.wsq";
                    wsqRingFileName = "rthumb.wsq";
                    lampMask |= 0x20;
                    break;
            }

            /* Turning the display leds depending on the mask */
            _fps.SetStatusLed(lampMask, color);

            //reqid = _fps.CaptureStart(100, 100, (int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, 0x10333300);
            reqid = _fps.CaptureStart(3000, 7000, (int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, handAndFingerMask);

            for (stat = 0; stat < 100; )
            {
                /* Test if better images are captured or capture has accomplished */
                stat = _fps.CaptureStatus(reqid);

                _helper.Wait(100);
            }

            /* Closing the capture sequence */
            _fps.CaptureWait(reqid);

            color = (int)FPS_STATUS_LED_COLOR.FPS_SLC_OFF;
            _fps.SetStatusLed(0xff, color); // off

            /* Save individual finger images */
            gxImage img;
            gxVariant var = null;
            int mask = 0x10;

            _arrayOfBMP = new ArrayList();
            _arrayOfWSQ = new ArrayList();

            for (int i = 0; i < 4; i++)
            {
                mask >>= 1;
                bool valid = true;
                switch (fingerMask & mask)
                {
                    case 0x08:
                        try
                        {
                            var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, index, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                            if (saveFingerAsFile)
                                _fps.SaveImage(0, index, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqIndexFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqIndexFileName);
                        }
                        break;
                    case 0x04:
                        try
                        {
                            var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, middle, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                            if (saveFingerAsFile)
                                _fps.SaveImage(0, middle, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqMiddleFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqMiddleFileName);
                        }
                        break;
                    case 0x02:
                        try
                        {
                            var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, ring, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                            if (saveFingerAsFile)
                                _fps.SaveImage(0, ring, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqRingFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqRingFileName);
                        }
                        break;
                    case 0x01:
                        try
                        {
                            var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, little, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                            if (saveFingerAsFile)
                                _fps.SaveImage(0, little, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqLittleFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqLittleFileName);
                        }
                        break;
                    default:
                        _arrayOfBMP.Add(new Byte[] { new Byte() });
                        _arrayOfWSQ.Add(new WsqImage());
        //                        _arrayOfWSQ.Add(new Byte[] { new Byte() });
                        continue;
                }

                if (valid)
                {
                    img = new gxImage();
                    gxVariant vtest = new gxVariant();
                    img.FromVariant(var);

                    WsqImage im = new WsqImage();
                    im.Content = img.SaveToMem((int)GX_IMGFILEFORMATS.GX_WSQ);
                    //im.Content = img.SaveToMem((int)GX_IMGFILEFORMATS.GX_BMP);
                    im.XRes = img.xres() / (10000 / 254);
                    im.YRes = img.yres() / (10000 / 254);
                    im.XSize = img.xsize();
                    im.YSize = img.ysize();
                    im.PixelFormat = img.format();
                    _arrayOfWSQ.Add(im);

                    _arrayOfBMP.Add(img.SaveToMem((int)GX_IMGFILEFORMATS.GX_BMP));
                    //_arrayOfWSQ.Add(img.SaveToMem((int)GX_IMGFILEFORMATS.GX_WSQ));
                    img.Dispose();
                }
                else
                {
                    //list.Add(new Byte[] { new Byte() });
                    _arrayOfBMP.Add(null);
                    _arrayOfWSQ.Add(null);
                }

                if (var != null)
                    var.Dispose();
            }
        }
        catch (gxException e)
        {
            return _helper.GetErrorMessage(e, out _errorMessage);
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- fpsGetFingersImages()";
            return 1305;
        }

        return 0;
    }
Exemplo n.º 3
0
    ////----------------------------------------------------------------------
    //void PreviewCaptured(object a, Pr22.Events.PreviewEventArgs e)
    //{
    //    Resolution = (int)(_fps.Scanner.GetLiveImage().HRes / 39.37);
    //    ScanState++;
    //    PrintState();
    //}
    ////----------------------------------------------------------------------
    //void ImageScanned(object a, Pr22.Events.FingerImageEventArgs e)
    //{
    //    int[] pos = { 0, 2, 0, 1, 2, 3, 1, 3, 2, 1, 0 };
    //    int ix = (int)e.position > 10 ? 0 : (int)e.position;
    //    Quality[pos[ix]] = _fps.Scanner.GetFinger(e.position, Pr22.Imaging.ImpressionType.Plain).GetQuality();
    //    PrintState();
    //}
    ////----------------------------------------------------------------------
    //void FingerScanned(object a, Pr22.Events.FingerEventArgs e)
    //{
    //    Message = e.fingerFailureMask.ToString();
    //    PrintState();
    //}
    ////----------------------------------------------------------------------
    //void PresenceStateChanged(object a, Pr22.Events.DetectionEventArgs e)
    //{
    //    Message = e.State.ToString();
    //    Detect = e.State;
    //    PrintState();
    //}
    //void PrintState()
    //{
    //    string States = "|/-\\";
    //    string Prog = "##########";
    //    System.Console.Write(" {0} {1,3} DPI Progress:[{2,-10}] [{3,-21}] Q1:{4,4} Q2:{5,4} Q3:{6,4} Q4:{7,4}\r",
    //        States[ScanState % 4], Resolution, Prog.Substring(10 - Progress / 10),
    //        Message, Quality[0], Quality[1], Quality[2], Quality[3]);
    //}
    ////----------------------------------------------------------------------
    public int fpsGetFingersImages(int handAndFingerMask, bool saveFingerAsFile)
    {
        try
        {
            if (_arrayOfBMP != null) { _arrayOfBMP.Clear(); _arrayOfBMP = null; }
            if (_arrayOfWSQ != null) { _arrayOfWSQ.Clear(); _arrayOfWSQ = null; }

            /* Clears internal stored finger buffers */
            _fps.Scanner.CleanUpData();

            /* Starts an asynchronous capture process
            // params: time in usec, quality in per-thousand, mode of live scan, fingerlist
            //
            // The finger list has the format 0hhh 0000 iiii mmmm rrrr llll tttt ssss
            //	h - scan object: 001 left hand, 010 right hand, 011 same fingers of both hands
            //	i - index finger	|
            //	m - middle finger	|
            //	r - ring finger		|--> value of FPS_PRESENCE   FPS_AVAILABLE = 3
            //	l - little finger	|
            //	t - left thumb		|
            //	s - right thumb		|
            */

            Pr22.Control.StatusLed.Color color = Pr22.Control.StatusLed.Color.Off;
            Pr22.Imaging.FingerPosition index = Pr22.Imaging.FingerPosition.Unknown;
            Pr22.Imaging.FingerPosition middle = Pr22.Imaging.FingerPosition.Unknown;
            Pr22.Imaging.FingerPosition ring = Pr22.Imaging.FingerPosition.Unknown;
            Pr22.Imaging.FingerPosition little = Pr22.Imaging.FingerPosition.Unknown;
            string wsqIndexFileName = String.Empty;
            string wsqMiddleFileName = String.Empty;
            string wsqRingFileName = String.Empty;
            string wsqLittleFileName = String.Empty;

            short idx = 0;
            foreach (Pr22.Control.StatusLed statled in _fps.Peripherals.StatusLeds)
            {
                if (idx++ > 11)
                    break;

                statled.Turn(color); // off
            }

            color = Pr22.Control.StatusLed.Color.Green;

            int fingerMask = 0x00;
            switch (handAndFingerMask & 0xff000000)
            {
                case 0x10000000:    //0x10333300    left hand
                case 0x20000000:    //0x20333300    right hand
                    fingerMask |= (handAndFingerMask & 0x00300000) != 0 ? 0x08 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00030000) != 0 ? 0x04 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00003000) != 0 ? 0x02 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00000300) != 0 ? 0x01 : 0x00;
                    break;
                case 0x30000000:    //0x20000033    thumbs
                    fingerMask |= (handAndFingerMask & 0x00000030) != 0 ? 0x04 : 0x00;
                    fingerMask |= (handAndFingerMask & 0x00000003) != 0 ? 0x02 : 0x00;
                    break;
            }

            int lampMask = fingerMask;
            switch (handAndFingerMask & 0xff000000)
            {
                case 0x10000000:    //0x10333300  left hand
                    index = Pr22.Imaging.FingerPosition.LeftIndex;
                    middle = Pr22.Imaging.FingerPosition.LeftMiddle;
                    ring = Pr22.Imaging.FingerPosition.LeftRing;
                    little = Pr22.Imaging.FingerPosition.LeftLittle;
                    wsqIndexFileName = "lindex.wsq";
                    wsqMiddleFileName = "lmiddle.wsq";
                    wsqRingFileName = "lring.wsq";
                    wsqLittleFileName = "llittle.wsq";
                    lampMask = 0x80;
                    lampMask |= (fingerMask & 0x00000001) != 0 ? 0x08 : 0x00;
                    lampMask |= (fingerMask & 0x00000002) != 0 ? 0x04 : 0x00;
                    lampMask |= (fingerMask & 0x00000004) != 0 ? 0x02 : 0x00;
                    lampMask |= (fingerMask & 0x00000008) != 0 ? 0x01 : 0x00;
                    break;
                case 0x20000000:    //0x20333300
                    index = Pr22.Imaging.FingerPosition.RightIndex;
                    middle = Pr22.Imaging.FingerPosition.RightMiddle;
                    ring = Pr22.Imaging.FingerPosition.RightRing;
                    little = Pr22.Imaging.FingerPosition.RightLittle;
                    wsqIndexFileName = "rindex.wsq";
                    wsqMiddleFileName = "rmiddle.wsq";
                    wsqRingFileName = "rring.wsq";
                    wsqLittleFileName = "rlittle.wsq";
                    lampMask |= 0x40;
                    break;
                case 0x30000000:    //0x30000033
                    middle = Pr22.Imaging.FingerPosition.LeftThumb;
                    ring = Pr22.Imaging.FingerPosition.RightThumb;
                    wsqMiddleFileName = "lthumb.wsq";
                    wsqRingFileName = "rthumb.wsq";
                    lampMask |= 0x20;
                    break;
            }

            /* Turning the display leds depending on the mask */
            for (int i = 0; i < 32; i++)
                if ((lampMask & (1 << i)) != 0)
                    _fps.Peripherals.StatusLeds[i].Turn(color);

            ////starting detection
            //TaskControl LiveTask =_fps.Scanner.StartTask(FingerTask.Detection());

            //int timeout = 10;  // in 100 milliseconds
            ////int i;

            //for (int i = 0; i < timeout && Detect != PresenceState.Present; ++i)
            //    System.Threading.Thread.Sleep(100);

            Pr22.Task.FingerTask ftask = Pr22.Task.FingerTask.PlainScan(700, 3000);
            //ftask.Add(index).Add(middle).Add(ring).Add(little).Del(Pr22.Imaging.FingerPosition.Unknown);
            //if (index != Pr22.Imaging.FingerPosition.Unknown) ftask.Add(index);
            //if (middle != Pr22.Imaging.FingerPosition.Unknown) ftask.Add(middle);
            //if (ring != Pr22.Imaging.FingerPosition.Unknown) ftask.Add(ring);
            //if (little != Pr22.Imaging.FingerPosition.Unknown) ftask.Add(little);

            int mask = 0x10;
            for (int i = 0; i < 4; i++)
            {
                mask >>= 1;
                switch (fingerMask & mask)
                {
                    case 0x08:
                        ftask.Add(index);
                        break;
                    case 0x04:
                        ftask.Add(middle);
                        break;
                    case 0x02:
                        ftask.Add(ring);
                        break;
                    case 0x01:
                        ftask.Add(little);
                        break;
                }
            }

            Pr22.Task.TaskControl tc = _fps.Scanner.StartTask(ftask);

            //for (stat = 0; stat < 100; )
            int status = 0;
            while (status < 100)
            {
                /* Test if better images are captured or capture has accomplished */
                status = tc.GetState();

                _helper.Wait(100);
            }

            /* Closing the capture sequence */
            tc.Wait();

            //for (int i = 0; i < timeout && Detect == PresenceState.Present; ++i)
            //    System.Threading.Thread.Sleep(100);

            //LiveTask.Stop();

            color = Pr22.Control.StatusLed.Color.Off;
            idx = 0;
            foreach (Pr22.Control.StatusLed statled in _fps.Peripherals.StatusLeds)
            {
                if (idx++ > 11)
                    break;

                statled.Turn(color); // off
            }

            /* Save individual finger images */
            Pr22.Imaging.RawImage rawImage;
            Pr22.Imaging.FingerImage fingerImage = null;
            mask = 0x10;

            _arrayOfBMP = new ArrayList();
            _arrayOfWSQ = new ArrayList();

            for (int i = 0; i < 4; i++)
            {
                mask >>= 1;
                bool valid = true;
                switch (fingerMask & mask)
                {
                    case 0x08:
                        try
                        {
                            fingerImage = _fps.Scanner.GetFinger(index, Pr22.Imaging.ImpressionType.Plain);
                            if (saveFingerAsFile)
                                fingerImage.GetImage().Save(Pr22.Imaging.RawImage.FileFormat.Wsq).Save(wsqIndexFileName);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqIndexFileName);
                        }
                        break;
                    case 0x04:
                        try
                        {
                            fingerImage = _fps.Scanner.GetFinger(middle, Pr22.Imaging.ImpressionType.Plain);
                            if (saveFingerAsFile)
                                fingerImage.GetImage().Save(Pr22.Imaging.RawImage.FileFormat.Wsq).Save(wsqMiddleFileName);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqMiddleFileName);
                        }
                        break;
                    case 0x02:
                        try
                        {
                            fingerImage = _fps.Scanner.GetFinger(ring, Pr22.Imaging.ImpressionType.Plain);
                            if (saveFingerAsFile)
                                fingerImage.GetImage().Save(Pr22.Imaging.RawImage.FileFormat.Wsq).Save(wsqRingFileName);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqRingFileName);
                        }
                        break;
                    case 0x01:
                        try
                        {
                            fingerImage = _fps.Scanner.GetFinger(little, Pr22.Imaging.ImpressionType.Plain);
                            if (saveFingerAsFile)
                                fingerImage.GetImage().Save(Pr22.Imaging.RawImage.FileFormat.Wsq).Save(wsqLittleFileName);
                        }
                        catch
                        {
                            valid = false;
                            if (saveFingerAsFile)
                                File.Delete(wsqLittleFileName);
                        }
                        break;
                    default:
                        _arrayOfBMP.Add(new Byte[] { new Byte() });
                        _arrayOfWSQ.Add(new WsqImage());
                        //_arrayOfWSQ.Add(new Byte[] { new Byte() });
                        continue;
                }

                if (valid)
                {
                    rawImage = fingerImage.GetImage();

                    WsqImage im = new WsqImage();
                    im.Content = rawImage.Save(Pr22.Imaging.RawImage.FileFormat.Wsq).ToByteArray();
                    //im.Content = img.SaveToMem((int)GX_IMGFILEFORMATS.GX_BMP);
                    im.XRes = rawImage.HRes / (10000 / 254);
                    im.YRes = rawImage.VRes / (10000 / 254);
                    im.XSize = rawImage.Size.Width;
                    im.YSize = rawImage.Size.Height;
                    im.PixelFormat = (int)rawImage.Format;
                    _arrayOfWSQ.Add(im);

                    _arrayOfBMP.Add(rawImage.Save(Pr22.Imaging.RawImage.FileFormat.Bmp).ToByteArray());
                    //_arrayOfWSQ.Add(img.SaveToMem((int)GX_IMGFILEFORMATS.GX_WSQ));
                    rawImage = null;
                }
                else
                {
                    //list.Add(new Byte[] { new Byte() });
                    _arrayOfBMP.Add(null);
                    _arrayOfWSQ.Add(null);
                }

                if (fingerImage != null)
                    fingerImage = null;
            }
        }
        catch (Pr22.Exceptions.General e)
        {
            return _helper.GetErrorMessage(e, out _errorMessage);
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- fpsGetFingersImages()";
            return 1305;
        }

        return 0;
    }
Exemplo n.º 4
0
 public static byte[] ConvertWSQToBmp(WsqImage wsq)
 {
     _wsqImg = new Pr22.Imaging.RawImage();
     _wsqImg.Load(new Pr22.Processing.BinData(wsq.Content));
     return _wsqImg.Save(Pr22.Imaging.RawImage.FileFormat.Bmp).ToByteArray();
 }
Exemplo n.º 5
0
 public byte[] ConvertWSQToBmp(WsqImage wsq)
 {
     return ARHFingerScanner.ConvertWSQToBmp(wsq);
 }
Exemplo n.º 6
0
    public int fpsGetFingersImages(int handAndFingerMask, bool saveFingerAsFile)
    {
        try
        {
            if (_arrayOfBMP != null)
            {
                _arrayOfBMP.Clear(); _arrayOfBMP = null;
            }
            if (_arrayOfWSQ != null)
            {
                _arrayOfWSQ.Clear(); _arrayOfWSQ = null;
            }

            /* Search Finger */
            int reqid, stat;

            /* Clears internal stored finger buffers */
            _fps.ResetFingerList();


            /* Starts an asynchronous capture process
             * // params: time in usec, quality in per-thousand, mode of live scan, fingerlist
             * //
             * // The finger list has the format 0hhh 0000 iiii mmmm rrrr llll tttt ssss
             * //	h - scan object: 001 left hand, 010 right hand, 011 same fingers of both hands
             * //	i - index finger	|
             * //	m - middle finger	|
             * //	r - ring finger		|--> value of FPS_PRESENCE   FPS_AVAILABLE = 3
             * //	l - little finger	|
             * //	t - left thumb		|
             * //	s - right thumb		|
             */

            int    color             = (int)FPS_STATUS_LED_COLOR.FPS_SLC_OFF;
            int    index             = 0;
            int    middle            = 0;
            int    ring              = 0;
            int    little            = 0;
            string wsqIndexFileName  = String.Empty;
            string wsqMiddleFileName = String.Empty;
            string wsqRingFileName   = String.Empty;
            string wsqLittleFileName = String.Empty;

            _fps.SetStatusLed(0xff, color); // off
            color = (int)FPS_STATUS_LED_COLOR.FPS_SLC_GREEN;

            int fingerMask = 0x00;
            switch (handAndFingerMask & 0xff000000)
            {
            case 0x10000000:        //0x10333300    left hand
            case 0x20000000:        //0x20333300    right hand
                fingerMask |= (handAndFingerMask & 0x00300000) != 0 ? 0x08 : 0x00;
                fingerMask |= (handAndFingerMask & 0x00030000) != 0 ? 0x04 : 0x00;
                fingerMask |= (handAndFingerMask & 0x00003000) != 0 ? 0x02 : 0x00;
                fingerMask |= (handAndFingerMask & 0x00000300) != 0 ? 0x01 : 0x00;
                break;

            case 0x30000000:        //0x20000033    thumbs
                fingerMask |= (handAndFingerMask & 0x00000030) != 0 ? 0x04 : 0x00;
                fingerMask |= (handAndFingerMask & 0x00000003) != 0 ? 0x02 : 0x00;
                break;
            }

            int lampMask = fingerMask;
            switch (handAndFingerMask & 0xff000000)
            {
            case 0x10000000:        //0x10333300  left hand
                index             = (int)FPS_POSITION.FPS_POS_LEFT_INDEX;
                middle            = (int)FPS_POSITION.FPS_POS_LEFT_MIDDLE;
                ring              = (int)FPS_POSITION.FPS_POS_LEFT_RING;
                little            = (int)FPS_POSITION.FPS_POS_LEFT_LITTLE;
                wsqIndexFileName  = "lindex.wsq";
                wsqMiddleFileName = "lmiddle.wsq";
                wsqRingFileName   = "lring.wsq";
                wsqLittleFileName = "llittle.wsq";
                lampMask          = 0x80;
                lampMask         |= (fingerMask & 0x00000001) != 0 ? 0x08 : 0x00;
                lampMask         |= (fingerMask & 0x00000002) != 0 ? 0x04 : 0x00;
                lampMask         |= (fingerMask & 0x00000004) != 0 ? 0x02 : 0x00;
                lampMask         |= (fingerMask & 0x00000008) != 0 ? 0x01 : 0x00;
                break;

            case 0x20000000:        //0x20333300
                index             = (int)FPS_POSITION.FPS_POS_RIGHT_INDEX;
                middle            = (int)FPS_POSITION.FPS_POS_RIGHT_MIDDLE;
                ring              = (int)FPS_POSITION.FPS_POS_RIGHT_RING;
                little            = (int)FPS_POSITION.FPS_POS_RIGHT_LITTLE;
                wsqIndexFileName  = "rindex.wsq";
                wsqMiddleFileName = "rmiddle.wsq";
                wsqRingFileName   = "rring.wsq";
                wsqLittleFileName = "rlittle.wsq";
                lampMask         |= 0x40;
                break;

            case 0x30000000:        //0x30000033
                middle            = (int)FPS_POSITION.FPS_POS_LEFT_THUMB;
                ring              = (int)FPS_POSITION.FPS_POS_RIGHT_THUMB;
                wsqMiddleFileName = "lthumb.wsq";
                wsqRingFileName   = "rthumb.wsq";
                lampMask         |= 0x20;
                break;
            }

            /* Turning the display leds depending on the mask */
            _fps.SetStatusLed(lampMask, color);

            //reqid = _fps.CaptureStart(100, 100, (int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, 0x10333300);
            reqid = _fps.CaptureStart(3000, 7000, (int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, handAndFingerMask);

            for (stat = 0; stat < 100;)
            {
                /* Test if better images are captured or capture has accomplished */
                stat = _fps.CaptureStatus(reqid);

                _helper.Wait(100);
            }

            /* Closing the capture sequence */
            _fps.CaptureWait(reqid);

            color = (int)FPS_STATUS_LED_COLOR.FPS_SLC_OFF;
            _fps.SetStatusLed(0xff, color); // off

            /* Save individual finger images */
            gxImage   img;
            gxVariant var  = null;
            int       mask = 0x10;

            _arrayOfBMP = new ArrayList();
            _arrayOfWSQ = new ArrayList();

            for (int i = 0; i < 4; i++)
            {
                mask >>= 1;
                bool valid = true;
                switch (fingerMask & mask)
                {
                case 0x08:
                    try
                    {
                        var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, index, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                        if (saveFingerAsFile)
                        {
                            _fps.SaveImage(0, index, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqIndexFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                    }
                    catch
                    {
                        valid = false;
                        if (saveFingerAsFile)
                        {
                            File.Delete(wsqIndexFileName);
                        }
                    }
                    break;

                case 0x04:
                    try
                    {
                        var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, middle, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                        if (saveFingerAsFile)
                        {
                            _fps.SaveImage(0, middle, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqMiddleFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                    }
                    catch
                    {
                        valid = false;
                        if (saveFingerAsFile)
                        {
                            File.Delete(wsqMiddleFileName);
                        }
                    }
                    break;

                case 0x02:
                    try
                    {
                        var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, ring, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                        if (saveFingerAsFile)
                        {
                            _fps.SaveImage(0, ring, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqRingFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                    }
                    catch
                    {
                        valid = false;
                        if (saveFingerAsFile)
                        {
                            File.Delete(wsqRingFileName);
                        }
                    }
                    break;

                case 0x01:
                    try
                    {
                        var = _fps.GetImage((int)FPS_IMPRESSION_TYPE.FPS_SCAN_LIVE, little, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER);
                        if (saveFingerAsFile)
                        {
                            _fps.SaveImage(0, little, (int)FPS_IMAGE_TYPE.FPS_IT_FINGER, wsqLittleFileName, (int)GX_IMGFILEFORMATS.GX_WSQ);
                        }
                    }
                    catch
                    {
                        valid = false;
                        if (saveFingerAsFile)
                        {
                            File.Delete(wsqLittleFileName);
                        }
                    }
                    break;

                default:
                    _arrayOfBMP.Add(new Byte[] { new Byte() });
                    _arrayOfWSQ.Add(new WsqImage());
//                        _arrayOfWSQ.Add(new Byte[] { new Byte() });
                    continue;
                }

                if (valid)
                {
                    img = new gxImage();
                    gxVariant vtest = new gxVariant();
                    img.FromVariant(var);

                    WsqImage im = new WsqImage();
                    im.Content = img.SaveToMem((int)GX_IMGFILEFORMATS.GX_WSQ);
                    //im.Content = img.SaveToMem((int)GX_IMGFILEFORMATS.GX_BMP);
                    im.XRes        = img.xres() / (10000 / 254);
                    im.YRes        = img.yres() / (10000 / 254);
                    im.XSize       = img.xsize();
                    im.YSize       = img.ysize();
                    im.PixelFormat = img.format();
                    _arrayOfWSQ.Add(im);

                    _arrayOfBMP.Add(img.SaveToMem((int)GX_IMGFILEFORMATS.GX_BMP));
                    //_arrayOfWSQ.Add(img.SaveToMem((int)GX_IMGFILEFORMATS.GX_WSQ));
                    img.Dispose();
                }
                else
                {
                    //list.Add(new Byte[] { new Byte() });
                    _arrayOfBMP.Add(null);
                    _arrayOfWSQ.Add(null);
                }

                if (var != null)
                {
                    var.Dispose();
                }
            }
        }
        catch (gxException e)
        {
            return(_helper.GetErrorMessage(e, out _errorMessage));
        }
        catch (Exception e)
        {
            _errorMessage = e.Message + " --- fpsGetFingersImages()";
            return(1305);
        }

        return(0);
    }