차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | |||
ko:bs2_getnormalizedimagefaceex [2022/05/13 12:01] mark [반환값] |
ko:bs2_getnormalizedimagefaceex [2022/06/30 07:24] mark [샘플코드] |
||
---|---|---|---|
줄 29: | 줄 29: | ||
C++ | C++ | ||
<code cpp> | <code cpp> | ||
- | char* uidObj = NULL; | + | sdkResult = BS2_GetNormalizedImageFaceEx(context_, id, unwarpedBuffer.get(), unwarpedSize, warpedBuffer.get(), &warpedSize); |
- | uint32_t numUID = 0; | + | |
- | int sdkResult = BS2_GetUserList(context_, id, &uidObj, &numUID, isAcceptableUID); | + | |
if (BS_SDK_SUCCESS != sdkResult) | if (BS_SDK_SUCCESS != sdkResult) | ||
{ | { | ||
- | TRACE("BS2_GetUserList call failed: %d", sdkResult); | + | TRACE("BS2_GetNormalizedImageFaceEx call failed: %d", sdkResult); |
return sdkResult; | return sdkResult; | ||
} | } | ||
- | // My Codes | ||
- | // | ||
- | // My Codes | ||
- | BS2_ReleaseObject(uidObj); | ||
</code> | </code> | ||
C# | C# | ||
<code cpp> | <code cpp> | ||
- | IntPtr outUidObjs = IntPtr.Zero; | + | BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetNormalizedImageFaceEx(sdkContext, deviceID, unwarpedImagePtr, unwarpedImageLen, warpedImagePtr, out warpedImageLen); |
- | UInt32 numUserIds = 0; | + | if (BS2ErrorCode.BS_SDK_SUCCESS == result) |
- | API.IsAcceptableUserID cbIsAcceptableUserID = null; // we don't need to user id filtering | + | { |
+ | byte[] warpedBuffer = new byte[warpedImageLen]; | ||
+ | Array.Clear(warpedBuffer, 0, (int)warpedImageLen); | ||
+ | Marshal.Copy(warpedImagePtr, warpedBuffer, 0, (int)warpedImageLen); | ||
+ | |||
+ | Console.WriteLine("Enter the path and name of warped image file"); | ||
+ | Console.Write(">> "); | ||
+ | string warpedPath = Console.ReadLine(); | ||
+ | if (warpedPath.Length == 0) | ||
+ | { | ||
+ | Console.WriteLine("The path and name can not be empty."); | ||
+ | return; | ||
+ | } | ||
- | IntPtr ptrDir = Marshal.StringToHGlobalAnsi(strDir); | + | File.WriteAllBytes(warpedPath, warpedBuffer); |
- | BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetUserList(sdkContext, deviceID, out outUidObjs, out numUserIds, cbIsAcceptableUserID); | + | } |
- | if (result != BS2ErrorCode.BS_SDK_SUCCESS) | + | else |
{ | { | ||
- | Console.WriteLine("Got error({0}).", result); | + | Console.WriteLine("Got error({0}).", result); |
- | return; | + | |
} | } | ||
- | API.BS2_ReleaseObject(outUidObjs); | + | |
+ | Marshal.FreeHGlobal(unwarpedImagePtr); | ||
+ | Marshal.FreeHGlobal(warpedImagePtr); | ||
</code> | </code> | ||