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