예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="numComponents">The number of components (read: Fisherfaces) kept for this Linear Discriminant Analysis
        /// with the Fisherfaces criterion. It's useful to keep all components, that means the number of your classes c
        /// (read: subjects, persons you want to recognize). If you leave this at the default (0) or set it
        /// to a value less-equal 0 or greater (c-1), it will be set to the correct number (c-1) automatically.</param>
        /// <param name="threshold">The threshold applied in the prediction. If the distance to the nearest neighbor
        /// is larger than the threshold, this method returns -1.</param>
        /// <returns></returns>
        public static BasicFaceRecognizer CreateFisherFaceRecognizer(
            int numComponents = 0, double threshold = Double.MaxValue)
        {
            IntPtr p = NativeMethods.face_createFisherFaceRecognizer(numComponents, threshold);

            return(BasicFaceRecognizer.FromPtr(p));
        }
예제 #2
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes.
        /// </summary>
        /// <param name="ptr"></param>
        internal new static BasicFaceRecognizer FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
            {
                throw new OpenCvSharpException($"Invalid cv::Ptr<{nameof(BasicFaceRecognizer)}> pointer");
            }
            var ptrObj   = new Ptr(ptr);
            var detector = new BasicFaceRecognizer
            {
                recognizerPtr = ptrObj,
                ptr           = ptrObj.Get()
            };

            return(detector);
        }