public LumiSDKWrapper.LumiStatus EnrollImage(byte[] snapShot, byte[] snapShot24bppPointer, byte[] template1Pointer, ref uint templateSize, uint width, uint height, ref int spoof, LumiSDKWrapper.LumiPresenceDetectCallbackDelegate callbackFunc, ref uint nNFIQ) { try { //byte[] snapShot = new byte[width * height]; // Array to hold raw data 8 bpp format // Make sure Presence Detection is on. // Because we need another definition for LumiSetOption, we call the SetPresenceDetectionMode // static method on the object LumiSDKLumiSetOption. This is because the LumiSDKWrapper // has the LumiSetOption defined to take the LumiPresenceDetectCallbackDelegate argument while for // setting PD mode, we need it to take an integer pointer argument instead. if (m_form.m_bSensorTriggerArmed) { LumiSDKLumiSetOption.SetPresenceDetectionMode(_hHandle, LumiSDKWrapper.LUMI_PRES_DET_MODE.LUMI_PD_ON); } else { LumiSDKLumiSetOption.SetPresenceDetectionMode(_hHandle, LumiSDKWrapper.LUMI_PRES_DET_MODE.LUMI_PD_OFF); } // Set the address of the presence detection callback function IntPtr prtDel = Marshal.GetFunctionPointerForDelegate(callbackFunc); _rc = LumiSDKWrapper.LumiSetOption(_hHandle, LumiSDKWrapper.LUMI_OPTIONS.LUMI_OPTION_SET_PRESENCE_DET_CALLBACK, prtDel, (uint)IntPtr.Size); if (_rc != LumiSDKWrapper.LumiStatus.LUMI_STATUS_OK) { return(_rc); } _rc = LumiSDKWrapper.LumiSetDCOptions(_hHandle, m_form.m_debugFolder, 0); if (_rc != LumiSDKWrapper.LumiStatus.LUMI_STATUS_OK) { return(_rc); } _rc = LumiSDKWrapper.LumiCaptureEx(_hHandle, snapShot, template1Pointer, ref templateSize, ref spoof, null); if (_rc != LumiSDKWrapper.LumiStatus.LUMI_STATUS_OK) { return(_rc); } else { _statusMessage += "PASS: lumiCaptureProcess rc = " + _rc + " spoof = " + spoof + "\r\n"; } GetNISTScore(snapShot, ref nNFIQ); LumiSDKWrapper.LumiSetOption(_hHandle, LumiSDKWrapper.LUMI_OPTIONS.LUMI_OPTION_SET_PRESENCE_DET_CALLBACK, IntPtr.Zero, (uint)IntPtr.Size); // size of int is 4 ConvertRawImageTo24bpp(snapShot24bppPointer, snapShot, snapShot.Length); return(_rc); } catch (Exception err) { _statusMessage += "An Error occured: " + err + "\r\n"; throw err; } finally { } }
public static void LumiCaptureWithPresenceDetectionFeedback(byte[] snapShot24bppPointer, byte[] template1Pointer, ref uint templateSize1, uint width, uint height, LumiSDKWrapper.LumiPresenceDetectCallbackDelegate callbackFunc) { try { byte[] snapShot = new byte[width * height]; // Array to hold raw data 8 bpp format int spoof = 0; // Make sure Presence Detection is on. // Because we need another definition for LumiSetOption, we call the SetPresenceDetectionMode // static method on the object LumiSDKLumiSetOption. This is because the LumiSDKWrapper // has the LumiSetOption defined to take the LumiPresenceDetectCallbackDelegate argument while for // setting PD mode, we need it to take an integer pointer argument instead. LumiSDKLumiSetOption.SetPresenceDetectionMode(_hHandle, LumiSDKWrapper.LUMI_PRES_DET_MODE.LUMI_PD_ON); // Set the address of the presence detection callback function IntPtr prtDel = Marshal.GetFunctionPointerForDelegate(callbackFunc); _rc = LumiSDKWrapper.LumiSetOption(_hHandle, LumiSDKWrapper.LUMI_OPTIONS.LUMI_OPTION_SET_PRESENCE_DET_CALLBACK, prtDel, GetIntPtrSz()); _rc = LumiSDKWrapper.LumiSetDCOptions(_hHandle, "C:/Temp/", 0); LumiSDKWrapper.LUMI_PROCESSING_MODE procMode; procMode.bExtract = 1; procMode.bLatent = 0; procMode.bSpoof = 1; _rc = LumiSDKWrapper.SetProcessingMode(_hHandle, procMode); procMode.bExtract = 0; _rc = LumiSDKWrapper.GetProcessingMode(_hHandle, ref procMode); //_rc = LumiCapture(_hHandle, snapshotPointer, &spoof, null); _rc = LumiSDKWrapper.LumiCaptureEx(_hHandle, snapShot, template1Pointer, ref templateSize1, ref spoof, null); if (_rc != LumiSDKWrapper.LumiStatus.LUMI_STATUS_OK) { throw new Exception("ERROR: lumiCaptureProcess rc = " + _rc); } else { _statusMessage += "PASS: lumiCaptureProcess rc = " + _rc + " spoof = " + spoof + "\r\n"; } LumiSDKWrapper.LumiSetOption(_hHandle, LumiSDKWrapper.LUMI_OPTIONS.LUMI_OPTION_SET_PRESENCE_DET_CALLBACK, IntPtr.Zero, GetIntPtrSz()); // size of int is 4 ConvertRawImageTo24bpp(snapShot24bppPointer, snapShot, snapShot.Length); } catch (Exception err) { _statusMessage += "An Error occured: " + err.ToString() + "\r\n"; //CloseScanner(); throw err; } finally { } }