public Bitmap ExportBitMap() { if (!Connected) { return(null); } var t = new _FTRSCAN_IMAGE_SIZE(); ftrScanGetImageSize(device, out t); byte[] arr = new byte[t.nImageSize]; ftrScanGetImage(device, 4, arr); var b = new Bitmap(t.nWidth, t.nHeight); for (int x = 0; x < t.nWidth; x++) { for (int y = 0; y < t.nHeight; y++) { int a = 255 - arr[y * t.nWidth + x]; b.SetPixel(x, y, Color.FromArgb(a, a, a)); } } return(b); }
public ImageResult GetFingerprint() { try { if (!Connected) { onInfo?.Invoke(MSGAPI3); return(null); } onInfo?.Invoke(MSGAPI8); var t = new _FTRSCAN_IMAGE_SIZE(); ftrScanGetImageSize(device, out t); byte[] arr = new byte[t.nImageSize]; ftrScanGetImage(device, dose, arr); int cx = crop ? 40 : 0; int cy = crop ? 60 : 0; int Width = crop ? t.nWidth - 80 : t.nWidth; int Height = crop ? t.nHeight - 80 : t.nHeight; int i = 0; // Em Crop: 320-80 x 480-80 = > 96000 bytes var ir = new ImageResult() { Data = new byte[Width * Height], Image = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb) }; for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { byte a = (byte)(0xFF - arr[((y + cy) * t.nWidth) + (x + cx)]); // a = (byte)x; // teste Gray Scale ir.Data[i] = a; ir.Image.SetPixel(x, y, Color.FromArgb(a, a, a)); i++; } } return(ir); } catch (Exception ex) { onError?.Invoke(ex); return(null); } }
public Bitmap ExportBitMap() { if (!Connected) return null; var t = new _FTRSCAN_IMAGE_SIZE(); ftrScanGetImageSize(device, out t); byte[] arr = new byte[t.nImageSize]; ftrScanGetImage(device, 4, arr); var b = new Bitmap(t.nWidth, t.nHeight); for (int x = 0; x < t.nWidth; x++) for (int y = 0; y < t.nHeight; y++) { int a = 255 - arr[y * t.nWidth + x]; b.SetPixel(x, y, Color.FromArgb(a, a, a)); } return b; }
static extern bool ftrScanGetImageSize(IntPtr ftrHandle, out _FTRSCAN_IMAGE_SIZE pImageSize);