예제 #1
0
        /// <summary>
        /// Method detects face on image provided as byte array.
        /// </summary>
        /// <param name="Image">[In]ImageObject object</param>
        /// <returns>Method returns list with detected faces or empty list when no faces found.</returns>
        public List <DETECTED_ITEM> DetectFaces(ImageObject ImageObject)
        {
            List <DETECTED_ITEM> DetectedFaces = new List <DETECTED_ITEM>();

            if ((ImageObject != null) && (FaceDetector_DetectFaces(IntObjPtr, ImageObject.InnerPtr) == FACE_DETECTION_RESULT.FD_RESULT_OK))
            {
                int DetectedCount = FaceDetector_GetDetectedCount(IntObjPtr);
                if (DetectedCount > 0)
                {
                    for (int i = 0; i < DetectedCount; i++)
                    {
                        DETECTED_ITEM Item = new DETECTED_ITEM();
                        FaceDetector_GetDetectedItem(IntObjPtr, i, ref Item);
                        DetectedFaces.Add(Item);
                    }
                    FaceDetector_DetectReset(IntObjPtr);
                }
            }
            return(DetectedFaces);
        }
예제 #2
0
 private static extern FACE_DETECTION_RESULT FaceDetector_GetDetectedItem(IntPtr Detector, int Index, ref DETECTED_ITEM Item);