차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
ko:bs2_scanfaceex [2020/08/21 13:18]
kkshin 만듦
ko:bs2_scanfaceex [2023/07/04 17:01] (현재)
줄 5: 줄 5:
  
 ===== BS2_ScanFaceEx ===== ===== BS2_ScanFaceEx =====
-[+ V2.7.1] ''​FaceStation F2''​ 장치에서 얼굴을 스캔하고 이미지 및 템플릿 데이터를 추출합니다.+[+ 2.7.1] ''​FaceStation F2''​ ''​BioStation 3''​ 장치에서 얼굴을 스캔하고 이미지 및 템플릿 데이터를 추출합니다.
 ==== 함수 ==== ==== 함수 ====
 <code cpp> <code cpp>
 #include "​BS_API.h"​ #include "​BS_API.h"​
  
-int BS2_ScanFaceEx(void* context, uint32_t deviceId, BS2FaceEx* faceEx, uint8_t ​erollmentThreshold, OnReadyToScan ptrReadyToScan);​+int BS2_ScanFaceEx(void* context, uint32_t deviceId, BS2FaceEx* faceEx, uint8_t ​enrollmentThreshold, OnReadyToScan ptrReadyToScan);​
 </​code>​ </​code>​
  
줄 20: 줄 20:
   * [In] ''//​deviceId//''​ : 장치 식별자   * [In] ''//​deviceId//''​ : 장치 식별자
   * [Out] ''//​faceEx//''​ : 얼굴 데이터를 저장할 포인터   * [Out] ''//​faceEx//''​ : 얼굴 데이터를 저장할 포인터
-  * [In] ''//​erollmentThreshold//''​ : 얼굴 등록시 요구되는 threshold 값. [[configuration_api#​bs2faceconfig|BS2FaceConfig enrollThreshold 참조]]+  * [In] ''//​enrollmentThreshold//''​ : 얼굴 등록시 요구되는 threshold 값. [[configuration_api#​bs2faceconfig|BS2FaceConfig::enrollThreshold 참조]]
   * [Out] ''//​ptrReadyToScan//''​ : 얼굴 스캔 준비가 완료되었을 때 호출되는 콜백 함수   * [Out] ''//​ptrReadyToScan//''​ : 얼굴 스캔 준비가 완료되었을 때 호출되는 콜백 함수
 ==== 반환값 ==== ==== 반환값 ====
 성공적으로 수행될 경우 ''​BS_SDK_SUCCESS''​를 반환하고,​ 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. ​ 성공적으로 수행될 경우 ''​BS_SDK_SUCCESS''​를 반환하고,​ 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. ​
-\\  ​+ 
 +==== 샘플코드 ==== 
 +C++ 
 +<code cpp> 
 +int UserControl::​scanFaceEx(BS2_DEVICE_ID id, BS2FaceEx* ptrFace, uint8_t&​ numOfFace) 
 +
 + if (!ptrFace) 
 + return BS_SDK_ERROR_INVALID_PARAM;​ 
 + 
 + const int MAX_RETRY = 2; 
 + int sdkResult = BS_SDK_SUCCESS;​ 
 + int retryCount = 0; 
 + 
 + while (retryCount < MAX_RETRY) 
 +
 + sdkResult = BS2_ScanFaceEx(context_,​ id, ptrFace, BS2_FACE_ENROLL_THRESHOLD_DEFAULT,​ onReadyToScanFace);​ 
 + if (BS_SDK_SUCCESS != sdkResult) 
 +
 + TRACE("​BS2_ScanFaceEx call failed: %d", sdkResult);​ 
 + retryCount++;​ 
 +
 + else 
 +
 + numOfFace++;​ 
 + break; 
 +
 +
 + 
 + return sdkResult;​ 
 +
 + 
 +BS2_ReleaseObject(uidObj);​ 
 +</​code>​ 
 +C# 
 +<code cpp> 
 +if (Util.IsYes()) 
 +
 + Console.WriteLine("​How many faceEx would you like to register?"​);​ 
 + Console.Write(">>​ "); 
 + int numOfFace = Util.GetInput(1);​ 
 + if (0 < numOfFace) 
 +
 +        int structSize = Marshal.SizeOf(typeof(BS2FaceExWarped));​ 
 +        BS2FaceExWarped[] faceEx = Util.AllocateStructureArray<​BS2FaceExWarped>​(1);​ 
 + userBlob[0].faceExObjs = Marshal.AllocHGlobal(structSize * numOfFace);​ 
 +        IntPtr curFaceExObjs = userBlob[0].faceExObjs;​ 
 +        cbFaceOnReadyToScan = new API.OnReadyToScan(ReadyToScanForFace);​ 
 + 
 + for (int index = 0; index < numOfFace;​) 
 +
 + sdkResult = (BS2ErrorCode)API.BS2_ScanFaceEx(sdkContext,​ deviceID, faceEx, (byte)BS2FaceEnrollThreshold.THRESHOLD_DEFAULT,​ cbFaceOnReadyToScan);​ 
 + if (BS2ErrorCode.BS_SDK_SUCCESS != sdkResult) 
 + Console.WriteLine("​BS2_ScanFaceEx call failed: %d", sdkResult);​ 
 + else 
 +
 +                userBlob[0].user.numFaces++;​ 
 + index++;​ 
 +                faceEx[0].faceIndex = (byte)index;​ 
 +                Marshal.StructureToPtr(faceEx[0],​ curFaceExObjs,​ false); 
 +                curFaceExObjs += structSize;​ 
 + 
 +                Thread.Sleep(100);​ 
 +
 +
 + 
 +        cbFaceOnReadyToScan = null; 
 +
 +
 +</​code>​