Ejemplo n.º 1
0
        //recebe HFIR retorna Bitmap
        public Bitmap Conversor(NBioAPI.Type.HFIR Fir_toImage)
        {
            NBioAPI.Export.EXPORT_AUDIT_DATA exportData;

            m_Export.NBioBSPToImage(Fir_toImage, out exportData);

            int nWidth  = (int)exportData.ImageWidth;
            int nHeight = (int)exportData.ImageHeight;



            {     // bmp image save...
                bmp = new Bitmap(nWidth, nHeight, PixelFormat.Format8bppIndexed);
                BitmapData data = bmp.LockBits(new Rectangle(0, 0, nWidth, nHeight), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);

                System.Runtime.InteropServices.Marshal.Copy(exportData.AuditData[0].Image[0].Data, 0, data.Scan0, nWidth * nHeight);
                bmp.UnlockBits(data);
                ColorPalette GrayscalePalette = bmp.Palette;
                for (int i = 0; i < 256; i++)
                {
                    GrayscalePalette.Entries[i] = Color.FromArgb(i, i, i);
                }

                bmp.Palette = GrayscalePalette;

                // bmp.Save("RollImage.bmp");
            }

            //Image img = bmp;

            return(bmp);
        }
        public Byte[] getfingerImage(NBioAPI.Type.HFIR Fir_toImage)
        {
            NBioAPI m_NBioAPI = new NBioAPI();

            NBioAPI.Export.EXPORT_AUDIT_DATA exportData;
            NBioAPI.Export m_Export = new NBioAPI.Export(m_NBioAPI);

            m_Export.NBioBSPToImage(Fir_toImage, out exportData);
            Bitmap bmp;
            int    nWidth  = (int)exportData.ImageWidth;
            int    nHeight = (int)exportData.ImageHeight;

            {     // bmp image save...
                bmp = new Bitmap(nWidth, nHeight, PixelFormat.Format8bppIndexed);
                BitmapData data = bmp.LockBits(new Rectangle(0, 0, nWidth, nHeight), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);

                System.Runtime.InteropServices.Marshal.Copy(exportData.AuditData[0].Image[0].Data, 0, data.Scan0, nWidth * nHeight);
                bmp.UnlockBits(data);
                ColorPalette GrayscalePalette = bmp.Palette;
                for (int i = 0; i < 256; i++)
                {
                    GrayscalePalette.Entries[i] = Color.FromArgb(i, i, i);
                }

                bmp.Palette = GrayscalePalette;

                // bmp.Save("RollImage.bmp");
            }

            //Image img = bmp;
            MemoryStream stream = new MemoryStream();

            bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
            Byte[] bytes = stream.ToArray();


            return(bytes);
        }
Ejemplo n.º 3
0
        private void ISOV1_Click(object sender, EventArgs e)
        {
            string szTemp;

            listRet.Items.Clear();
            listRet.Items.Add("OpenDevice start...");

            uint nRet = m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);

            if (nRet == NBioAPI.Error.NONE)
            {
                NBioAPI.Type.HFIR hFIR, hAuditFIR;

                hAuditFIR = new NBioAPI.Type.HFIR();

                listRet.Items.Add("Enroll start...");

                m_NBioAPI.Enroll(null, out hFIR, null, NBioAPI.Type.TIMEOUT.DEFAULT, hAuditFIR, null);

                if (nRet == NBioAPI.Error.NONE)
                {
                    NBioAPI.Export.EXPORT_AUDIT_DATA exportData;

                    listRet.Items.Add("NBioBSPToImage start...");

                    nRet = m_Export.NBioBSPToImage(hAuditFIR, out exportData);

                    if (nRet == NBioAPI.Error.NONE)
                    {
                        byte[] ISOBuf;

                        listRet.Items.Add("ExportRawToISOV1 start...");

                        nRet = NBioBSPISO4.ExportRawToISOV1(exportData, false, NBioBSPISO4.COMPRESS_MOD.NONE, out ISOBuf);

                        if (nRet == NBioAPI.Error.NONE)
                        {
                            NBioBSPISO4.NIMPORTRAWSET ImportRawSet;

                            listRet.Items.Add("ImportISOToRaw start...");

                            nRet = NBioBSPISO4.ImportISOToRaw(ISOBuf, out ImportRawSet);

                            if (nRet == NBioAPI.Error.NONE)
                            {
                                listRet.Items.Add("Test result");

                                for (byte i = 0; i < ImportRawSet.nDataCount; i++)
                                {
                                    szTemp = "DataLen: " + ImportRawSet.ImportRawData[i].RawData.Length;
                                    listRet.Items.Add(szTemp);

                                    szTemp = "FingerID: " + ImportRawSet.ImportRawData[i].nFingerID;
                                    listRet.Items.Add(szTemp);

                                    szTemp = "Image Width: " + ImportRawSet.ImportRawData[i].nImgWidth;
                                    listRet.Items.Add(szTemp);

                                    szTemp = "Image Height: " + ImportRawSet.ImportRawData[i].nImgHeight;
                                    listRet.Items.Add(szTemp);
                                }
                            }
                            else
                            {
                                szTemp = "ImportISOToRaw Error: " + nRet;
                                listRet.Items.Add(szTemp);
                            }
                        }
                        else
                        {
                            szTemp = "ExportRawToISOV1 Error: " + nRet;
                            listRet.Items.Add(szTemp);
                        }
                    }
                    else
                    {
                        szTemp = "NBioBSPToImage Error: " + nRet;
                        listRet.Items.Add(szTemp);
                    }

                    hFIR.Dispose();
                    hAuditFIR.Dispose();
                }
                else
                {
                    szTemp = "Enroll Error: " + nRet;
                    listRet.Items.Add(szTemp);
                }

                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            }
            else
            {
                szTemp = "CloseDevice Error: " + nRet;
                listRet.Items.Add(szTemp);
            }
        }