public static HWRESULT HWDetectFaceKeyPoints(HW_HANDLE Handle, IntPtr pImg, int nImgWidth, int nImgHeight, ref int pnMaxFace, ref HWFaceInfo[] pFaceInfo) { if (pnMaxFace <= 0) { return(S_FAIL); } int nSizeStruct = Marshal.SizeOf(typeof(HWFaceInfo)); IntPtr ptr = Marshal.AllocHGlobal(nSizeStruct * pnMaxFace); HWRESULT hr = HWDetectFaceKeyPoints(Handle, pImg, nImgWidth, nImgHeight, ref pnMaxFace, ptr); if (hr == S_OK) { IntPtr ptrData = ptr; for (int i = 0; i < pnMaxFace; i++) { pFaceInfo[i] = (HWFaceInfo)Marshal.PtrToStructure(ptrData, typeof(HWFaceInfo)); ptrData += nSizeStruct; } } Marshal.FreeHGlobal(ptr); return(hr); }
public void Dispose() { if (handleLib != IntPtr.Zero) { HWRelease(ref handleLib); handleLib = IntPtr.Zero; } HWReleaseD(); if (idPhotoData != null) { PicPixel.DeletePicPixel(ref idPhotoData); } if (livePhotoData != null) { PicPixel.DeletePicPixel(ref livePhotoData); } ClearPhoto(ref bmLivePhoto); ClearPhoto(ref bmFaceLivePhoto); }
public static extern HWRESULT HWDetectFaceKeyPoints(HW_HANDLE Handle, IntPtr pImg, int nImgWidth, int nImgHeight, ref int pnMaxFace, IntPtr pFaceInfo);
public static extern HWRESULT HWRelease(ref HW_HANDLE pHandle);
public static extern HWRESULT HWInitial(ref HW_HANDLE pHandle, [MarshalAs(UnmanagedType.LPStr)] string strName);
public static extern HWRESULT HWCompareFeature(HW_HANDLE Handle, IntPtr pFeaA, IntPtr pFeaB, ref float fScore);
public static extern HWRESULT HWExtractFeature(HW_HANDLE Handle, IntPtr pImg, int nImgWidth, int nImgHeight, ref HWFaceInfo pFaceInfo, IntPtr pOutFeature);
public static extern HWRESULT HWGetFeatureSize(HW_HANDLE Handle, ref int piFtrSize);
public static extern HWRESULT HWSetPortrait(HW_HANDLE Handle, int iPortrait);