Пример #1
0
        /// <summary>
        /// Class constructor. Creates object for image.
        /// </summary>
        /// <param name="Image">[In]Pointer to Bitmap object.</param>
        /// <param name="MinFaceSize">[In]Minimum face size in pixels default value is 20% of image size.</param>
        public FaceDetector(Image Image, int MinFaceSize = -1)
        {
            FACE_DETECTOR_SETTINGS Settings = new FACE_DETECTOR_SETTINGS();

            Settings.nHeight = Image.Height;
            Settings.nWidth  = Image.Width;
            if (MinFaceSize < 0)
            {
                MinFaceSize = (int)(Math.Min(Image.Width, Image.Height) * 0.2);
            }
            Settings.nMinFaceSize = MinFaceSize;
            FaceDetector_Create(ref Settings, ref IntObjPtr);
        }
Пример #2
0
        /// <summary>
        /// Static method that detects faces on image provided as byte array.First byte corresponds to lower left corner on image.
        /// </summary>
        /// <param name="Image">[In]ImageObject object</param>
        /// <param name="Width">[In]Image width</param>
        /// <param name="Height">[In]Image height</param>
        /// <param name="MinFaceSize">[In]Minimum face size in pixels default value is 20% of image size.</param>
        /// <returns>Method returns list with detected faces or empty list when no faces found.</returns>
        public static List <DETECTED_ITEM> DetectFacesfromImage(ImageObject ImageObject, int Width, int Height, int MinFaceSize = -1)
        {
            if (MinFaceSize < 0)
            {
                MinFaceSize = (int)(Math.Min(Width, Height) * 0.2);
            }
            FACE_DETECTOR_SETTINGS Settings = new FACE_DETECTOR_SETTINGS();

            Settings.nHeight      = Height;
            Settings.nWidth       = Width;
            Settings.nMinFaceSize = MinFaceSize;
            FaceDetector TempDetector = new FaceDetector(Settings);

            return(TempDetector.DetectFaces(ImageObject));
        }
Пример #3
0
 /// <summary>
 /// Constructor. Creates object using specified settings.
 /// </summary>
 /// <param name="Settings">[In]Face detector settings</param>
 public FaceDetector(FACE_DETECTOR_SETTINGS Settings)
 {
     FaceDetector_Create(ref Settings, ref IntObjPtr);
 }
Пример #4
0
 private static extern FACE_DETECTION_RESULT FaceDetector_Create(ref FACE_DETECTOR_SETTINGS Settings, ref IntPtr Detector);