차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
ko:bs2_getnormalizedimagefaceex [2021/05/26 15:45] kkshin 만듦 |
ko:bs2_getnormalizedimagefaceex [2022/06/30 07:24] mark [샘플코드] |
||
---|---|---|---|
줄 26: | 줄 26: | ||
성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | ||
\\ | \\ | ||
+ | ==== 샘플코드 ==== | ||
+ | C++ | ||
+ | <code cpp> | ||
+ | sdkResult = BS2_GetNormalizedImageFaceEx(context_, id, unwarpedBuffer.get(), unwarpedSize, warpedBuffer.get(), &warpedSize); | ||
+ | if (BS_SDK_SUCCESS != sdkResult) | ||
+ | { | ||
+ | TRACE("BS2_GetNormalizedImageFaceEx call failed: %d", sdkResult); | ||
+ | return sdkResult; | ||
+ | } | ||
+ | </code> | ||
+ | C# | ||
+ | <code cpp> | ||
+ | BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetNormalizedImageFaceEx(sdkContext, deviceID, unwarpedImagePtr, unwarpedImageLen, warpedImagePtr, out warpedImageLen); | ||
+ | if (BS2ErrorCode.BS_SDK_SUCCESS == result) | ||
+ | { | ||
+ | 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; | ||
+ | } | ||
+ | |||
+ | File.WriteAllBytes(warpedPath, warpedBuffer); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | Console.WriteLine("Got error({0}).", result); | ||
+ | } | ||
+ | |||
+ | Marshal.FreeHGlobal(unwarpedImagePtr); | ||
+ | Marshal.FreeHGlobal(warpedImagePtr); | ||
+ | </code> | ||