示例#1
0
 /// <summary>
 /// Release the unmanaged memory associated with this object.
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         FaceInvoke.cveFacemarkLBFParamsRelease(ref _ptr);
     }
 }
示例#2
0
 /// <summary>
 /// Release all the unmanaged memory associated with this Facemark
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         FaceInvoke.cveFacemarkAAMRelease(ref _ptr, ref _sharedPtr);
     }
 }
示例#3
0
 /// <summary>
 /// train it on positive features compute the mace filter: h = D(-1) * X * (X(+) * D(-1) * X)(-1) * C also calculate a minimal threshold for this class, the smallest self-similarity from the train images
 /// </summary>
 /// <param name="images">A VectorOfMat with the train images</param>
 public void Train(IInputArrayOfArrays images)
 {
     using (InputArray iaImages = images.GetInputArray())
     {
         FaceInvoke.cveMaceTrain(_ptr, iaImages);
     }
 }
示例#4
0
 /// <summary>
 /// optionally encrypt images with random convolution
 /// </summary>
 /// <param name="passphrase">a crc64 random seed will get generated from this</param>
 public void Salt(String passphrase)
 {
     using (CvString csPassphrase = new CvString(passphrase))
     {
         FaceInvoke.cveMaceSalt(_ptr, csPassphrase);
     }
 }
示例#5
0
 /// <summary>
 /// correlate query img and threshold to min class value
 /// </summary>
 /// <param name="query">a Mat with query image</param>
 /// <returns>True if the query is the same</returns>
 public bool Same(IInputArray query)
 {
     using (InputArray iaQuery = query.GetInputArray())
     {
         return(FaceInvoke.cveMaceSame(_ptr, iaQuery));
     }
 }
示例#6
0
 /// <summary>
 /// Sets string info for the specified model's label.
 /// </summary>
 /// <param name="label">The label</param>
 /// <param name="strInfo">The string info</param>
 /// <remarks>The string info is replaced by the provided value if it was set before for the specified label.</remarks>
 public void SetLabelInfo(int label, String strInfo)
 {
     using (CvString csStrInfo = new CvString(strInfo))
     {
         FaceInvoke.cveFaceRecognizerSetLabelInfo(_faceRecognizerPtr, label, csStrInfo);
     }
 }
示例#7
0
 /// <summary>
 /// Gets string information by label. If an unknown label id is provided or there is no label information associated with the specified label id the method returns an empty string.
 /// </summary>
 /// <param name="label">The label</param>
 /// <returns>The string associated with this label.</returns>
 public String GetLabelInfo(int label)
 {
     using (CvString csStrInfo = new CvString())
     {
         FaceInvoke.cveFaceRecognizerGetLabelInfo(_faceRecognizerPtr, label, csStrInfo);
         return(csStrInfo.ToString());
     }
 }
示例#8
0
 /// <summary>
 /// Release the unmanaged memory associated with this FisherFaceRecognizer
 /// </summary>
 protected override void DisposeObject()
 {
     if (_sharedPtr == IntPtr.Zero)
     {
         FaceInvoke.cveLBPHFaceRecognizerRelease(ref _sharedPtr);
     }
     base.DisposeObject();
 }
示例#9
0
 /// <summary>
 /// Release the unmanaged memory associated with this BIF
 /// </summary>
 protected override void DisposeObject()
 {
     if (_sharedPtr != IntPtr.Zero)
     {
         FaceInvoke.cveBIFRelease(ref _sharedPtr);
         _ptr = IntPtr.Zero;
     }
 }
示例#10
0
 /// <summary>
 /// Create a LBPH face recognizer
 /// </summary>
 /// <param name="radius">Radius</param>
 /// <param name="neighbors">Neighbors</param>
 /// <param name="gridX">Grid X</param>
 /// <param name="gridY">Grid Y</param>
 /// <param name="threshold">The distance threshold</param>
 public LBPHFaceRecognizer(int radius       = 1, int neighbors = 8, int gridX = 8, int gridY = 8,
                           double threshold = Double.MaxValue)
 {
     _ptr = FaceInvoke.cveLBPHFaceRecognizerCreate(
         radius,
         neighbors,
         gridX,
         gridY,
         threshold,
         ref _faceRecognizerPtr,
         ref _sharedPtr);
 }
示例#11
0
        /// <summary>
        /// Predict the label of the image
        /// </summary>
        /// <param name="image">The image where prediction will be based on</param>
        /// <returns>The prediction label</returns>
        public PredictionResult Predict(IInputArray image)
        {
            int    label    = -1;
            double distance = -1;

            using (InputArray iaImage = image.GetInputArray())
                FaceInvoke.cveFaceRecognizerPredict(_faceRecognizerPtr, iaImage, ref label, ref distance);
            return(new PredictionResult()
            {
                Label = label, Distance = distance
            });
        }
示例#12
0
 /// <summary>
 /// Updates a FaceRecognizer with given data and associated labels.
 /// </summary>
 /// <param name="images">The training images, that means the faces you want to learn. The data has to be given as a VectorOfMat.</param>
 /// <param name="labels">The labels corresponding to the images</param>
 public void Update(IInputArray images, IInputArray labels)
 {
     using (InputArray iaImages = images.GetInputArray())
         using (InputArray iaLabels = labels.GetInputArray())
             FaceInvoke.cveFaceRecognizerUpdate(_faceRecognizerPtr, iaImages, iaLabels);
 }
示例#13
0
 /// <summary>
 /// Create a FisherFaceRecognizer
 /// </summary>
 /// <param name="numComponents">The number of components</param>
 /// <param name="threshold">The distance threshold</param>
 public FisherFaceRecognizer(int numComponents = 0, double threshold = double.MaxValue)
 {
     _ptr = FaceInvoke.cveFisherFaceRecognizerCreate(numComponents, threshold, ref _faceRecognizerPtr, ref _basicFaceRecognizerPtr, ref _sharedPtr);
 }
示例#14
0
 /// <summary>
 /// Computes features by input image.
 /// </summary>
 /// <param name="image">Input image (CV_32FC1)</param>
 /// <param name="features">Feature vector (CV_32FC1)</param>
 public void Compute(IInputArray image, IOutputArray features)
 {
     using (InputArray iaImage = image.GetInputArray())
         using (OutputArray oaFeatures = features.GetOutputArray())
             FaceInvoke.cveBIFCompute(_ptr, iaImage, oaFeatures);
 }
示例#15
0
 /// <summary>
 /// Create an instance of bio-inspired features
 /// </summary>
 /// <param name="numBands">The number of filter bands used for computing BIF.</param>
 /// <param name="numRotations">The number of image rotations.</param>
 public BIF(int numBands, int numRotations)
 {
     _ptr = FaceInvoke.cveBIFCreate(numBands, numRotations, ref _sharedPtr);
 }
示例#16
0
文件: BIF.cs 项目: aray2000/TFM
 /// <summary>
 /// Release the unmanaged memory associated with this BIF
 /// </summary>
 protected override void DisposeObject()
 {
     FaceInvoke.cveBIFRelease(ref _ptr);
 }
示例#17
0
 /// <summary>
 /// Load the FaceRecognizer from the file
 /// </summary>
 /// <param name="fileName">The file where the FaceRecognizer will be loaded from</param>
 public void Read(String fileName)
 {
     using (CvString s = new CvString(fileName))
         FaceInvoke.cveFaceRecognizerRead(_ptr, s);
 }
示例#18
0
 /// <summary>
 /// Create an instance of FacemarkAAM model
 /// </summary>
 /// <param name="parameters">The model parameters</param>
 public FacemarkAAM(FacemarkAAMParams parameters)
 {
     _ptr = FaceInvoke.cveFacemarkAAMCreate(parameters, ref _facemarkPtr, ref _algorithmPtr, ref _sharedPtr);
 }
示例#19
0
 /// <summary>
 /// Release the unmanaged memory associated with this FaceRecognizer
 /// </summary>
 protected override void DisposeObject()
 {
     FaceInvoke.cveFaceRecognizerRelease(ref _ptr, ref _sharedPtr);
 }
示例#20
0
 /// <summary>
 /// Create an EigenFaceRecognizer
 /// </summary>
 /// <param name="numComponents">The number of components</param>
 /// <param name="threshold">The distance threshold</param>
 public EigenFaceRecognizer(int numComponents = 0, double threshold = double.MaxValue)
 {
     _ptr = FaceInvoke.cveEigenFaceRecognizerCreate(numComponents, threshold, ref _sharedPtr);
 }
示例#21
0
 /// <summary>
 /// Create an instance of the FacemarkLBF model
 /// </summary>
 /// <param name="parameters">The model parameters</param>
 public FacemarkLBF(FacemarkLBFParams parameters)
 {
     _ptr = FaceInvoke.cveFacemarkLBFCreate(parameters, ref _facemarkPtr, ref _algorithmPtr);
 }
示例#22
0
 /// <summary>
 /// Create a new MACE object
 /// </summary>
 /// <param name="imgSize">images will get resized to this (should be an even number)</param>
 public MACE(int imgSize)
 {
     _ptr = FaceInvoke.cveMaceCreate(imgSize, ref _sharedPtr);
 }
示例#23
0
 /// <summary>
 /// Save the FaceRecognizer to a file
 /// </summary>
 /// <param name="fileName">The file name to be saved to</param>
 public void Write(String fileName)
 {
     using (CvString s = new CvString(fileName))
         FaceInvoke.cveFaceRecognizerWrite(_faceRecognizerPtr, s);
 }
示例#24
0
 /// <summary>
 /// Create the paramaters with the default values.
 /// </summary>
 public FacemarkAAMParams()
 {
     _ptr = FaceInvoke.cveFacemarkAAMParamsCreate();
 }
示例#25
0
文件: BIF.cs 项目: aray2000/TFM
 /// <summary>
 /// Create an instance of bio-inspired features
 /// </summary>
 /// <param name="numBands">The number of filter bands used for computing BIF.</param>
 /// <param name="numRotations">The number of image rotations.</param>
 public BIF(int numBands, int numRotations)
 {
     _ptr = FaceInvoke.cveBIFCreate(numBands, numRotations);
 }
示例#26
0
 /// <summary>
 /// Create a FisherFaceRecognizer
 /// </summary>
 /// <param name="numComponents">The number of components</param>
 /// <param name="threshold">The distance threshold</param>
 public FisherFaceRecognizer(int numComponents = 0, double threshold = double.MaxValue)
 {
     _ptr = FaceInvoke.cveFisherFaceRecognizerCreate(numComponents, threshold);
 }
示例#27
0
 /// <summary>
 /// Train the face recognizer with the specific images and labels
 /// </summary>
 /// <param name="images">The images used in the training. This can be a VectorOfMat</param>
 /// <param name="labels">The labels of the images. This can be a VectorOfInt</param>
 public void Train(IInputArray images, IInputArray labels)
 {
     using (InputArray iaImage = images.GetInputArray())
         using (InputArray iaLabels = labels.GetInputArray())
             FaceInvoke.cveFaceRecognizerTrain(_faceRecognizerPtr, iaImage, iaLabels);
 }