차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
ko:bs2_getnormalizedimagefaceex [2022/05/13 12:01] mark [반환값] |
ko:bs2_getnormalizedimagefaceex [2024/05/28 19:47] (현재) kkshin |
||
---|---|---|---|
줄 5: | 줄 5: | ||
===== BS2_GetNormalizedImageFaceEx ===== | ===== BS2_GetNormalizedImageFaceEx ===== | ||
- | [+ 2.8] ''FaceStation F2'' WARP 되어지지 않은(가공되어지지 않은) 얼굴 이미지로, WARP 이미지를 만듭니다. \\ | + | [+ 2.8] ''Visual Face 기반'' WARP 되어지지 않은(가공되어지지 않은) 얼굴 이미지로, WARP 이미지를 만듭니다. \\ |
서버는 WARP 이미지를 사용자 별로 보관하다가, \\ | 서버는 WARP 이미지를 사용자 별로 보관하다가, \\ | ||
서버매칭 요청 시 해당 사용자의 WARP 이미지를 장치에 내려주는 형태로 서버매칭의 구현이 가능합니다. \\ | 서버매칭 요청 시 해당 사용자의 WARP 이미지를 장치에 내려주는 형태로 서버매칭의 구현이 가능합니다. \\ | ||
줄 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> | ||