Exemple #1
0
        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);
        }
Exemple #2
0
 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);
 }
Exemple #3
0
 public static extern HWRESULT HWDetectFaceKeyPoints(HW_HANDLE Handle,
                                                     IntPtr pImg,
                                                     int nImgWidth, int nImgHeight,
                                                     ref int pnMaxFace,
                                                     IntPtr pFaceInfo);
Exemple #4
0
 public static extern HWRESULT HWRelease(ref HW_HANDLE pHandle);
Exemple #5
0
 public static extern HWRESULT HWInitial(ref HW_HANDLE pHandle, [MarshalAs(UnmanagedType.LPStr)] string strName);
Exemple #6
0
 public static extern HWRESULT HWCompareFeature(HW_HANDLE Handle,
                                                IntPtr pFeaA,
                                                IntPtr pFeaB,
                                                ref float fScore);
Exemple #7
0
 public static extern HWRESULT HWExtractFeature(HW_HANDLE Handle,
                                                IntPtr pImg, int nImgWidth, int nImgHeight,
                                                ref HWFaceInfo pFaceInfo,
                                                IntPtr pOutFeature);
Exemple #8
0
 public static extern HWRESULT HWGetFeatureSize(HW_HANDLE Handle, ref int piFtrSize);
Exemple #9
0
 public static extern HWRESULT HWSetPortrait(HW_HANDLE Handle, int iPortrait);