Hi,
I have an Intel Real sense Camera and I can use it to set up the Window Hello login on Window 10. Now I can trying to use the face recognition programmatically using Window Biometric Framework on window 10. I cannot find needed documentation
and sample to do that, But I managed to have some code to use the API. I have following methodEnrollSysPool and it called as
hr = EnrollSysPool(TRUE, WINBIO_ANSI_385_FACE_FRONTAL_FULL);
HRESULTEnrollSysPool(
BOOLdiscardEnrollment,
WINBIO_BIOMETRIC_SUBTYPEsubFactor)
{
HRESULThr
= S_OK;
WINBIO_IDENTITYidentity
= { 0 };
identity.Type = WINBIO_ID_TYPE_GUID;
WINBIO_SESSION_HANDLEsessionHandle
= NULL;
WINBIO_UNIT_IDunitId
= 1;
WINBIO_REJECT_DETAILrejectDetail
= 0;
BOOLEANisNewTemplate
= TRUE;
// Connect to the system pool.
hr = WinBioOpenSession(
WINBIO_TYPE_FACIAL_FEATURES,// Service provider
//WINBIO_TYPE_THERMAL_FACE_IMAGE, // Service
provider
WINBIO_POOL_SYSTEM,// Pool type
//WINBIO_POOL_PRIVATE,
WINBIO_FLAG_DEFAULT,// Configuration and access
NULL,// Array of biometric unit IDs
0, // Count of biometric unit IDs
WINBIO_DB_DEFAULT,// Database ID
&sessionHandle// [out] Session handle
);
if(FAILED(hr))
{
wprintf_s(L"\n WinBioOpenSession failed.");
wprintf_s(L"hr = 0x%x\n",
hr);
gotoe_Exit;
}
// Locate a sensor.
/*wprintf_s(L"\n Swipe your finger on the
sensor...\n");
hr = WinBioLocateSensor(sessionHandle, &unitId);
if (FAILED(hr))
{
wprintf_s(L"\n WinBioLocateSensor failed. hr = 0x%x\n", hr);
goto e_Exit;
}*/
// Begin the enrollment sequence.
wprintf_s(L"\n Starting enrollment sequence...\n");
hr = WinBioEnrollBegin(
sessionHandle, // Handle to open biometric session
subFactor,// Finger to create template for
unitId // Biometric unit ID
);
if(FAILED(hr))
{
wprintf_s(L"\n WinBioEnrollBegin failed.
hr = 0x%x\n", hr);
gotoe_Exit;
}
// Capture enrollment information by swiping
the sensor with
// the finger identified by the subFactor argument
in the
// WinBioEnrollBegin function.
for(intfaceCapture
= 1;; ++faceCapture)
{
wprintf_s(L"\n Camera to capture %s face
sample.",
(faceCapture == 1) ?L"the first":L"another");
hr = WinBioEnrollCapture(
sessionHandle, // Handle to open biometric session
&rejectDetail // [out] Failure information
);
wprintf_s(L"\n Sample %d captured from unit
number %d.",
faceCapture,
unitId);
if(hr
== WINBIO_I_MORE_DATA)
{
wprintf_s(L"\n More data required.\n");
continue;
}
if(FAILED(hr))
{
if(hr
== WINBIO_E_BAD_CAPTURE)
{
wprintf_s(L"\n Error: Bad capture; reason:
%d",
rejectDetail);
continue;
}
else
{
wprintf_s(L"\n WinBioEnrollCapture failed.
hr = 0x%x", hr);
gotoe_Exit;
}
}
else
{
wprintf_s(L"\n Template completed.\n");
break;
}
}
// Discard the enrollment if the appropriate
flag is set.
// Commit the enrollment if it is not discarded.
if(discardEnrollment==TRUE)
{
wprintf_s(L"\n Discarding enrollment...\n\n");
hr = WinBioEnrollDiscard(sessionHandle);
if(FAILED(hr))
{
wprintf_s(L"\n WinBioLocateSensor failed.
hr = 0x%x\n", hr);
}
gotoe_Exit;
}
else
{
wprintf_s(L"\n Committing enrollment...\n");
hr = WinBioEnrollCommit(
sessionHandle, // Handle to open biometric session
&identity, // WINBIO_IDENTITY object for the user
&isNewTemplate);// Is this a new template
if(FAILED(hr))
{
wprintf_s(L"\n WinBioEnrollCommit failed.
hr = 0x%x\n", hr);
gotoe_Exit;
}
}
e_Exit:
if(sessionHandle
!= NULL)
{
WinBioCloseSession(sessionHandle);
sessionHandle = NULL;
}
wprintf_s(L" Press any key to continue...");
_getch();
returnhr;
}
It failed in calling WinBioEnrollCapture.
I also tried the WinBioVerify, it also failed.
So is there anything I need to set up to enable the Window Biometric Framework to connect to my camera. Or the face recognition is not actually working at all in Window Biometric Framework.
You help is greatly appreciated.
Sincerely,
Ping Tian
ping.tian@razerzone.com