|
visageSDK
|
Objective-C wrapper of the VisageSDK::VisageFaceRecognition class. More...
#import <objc_VisageFaceRecognition.h>
Inherits NSObject.
Instance Methods | |
| (VisageFaceRecognition *) | - init: |
| Constructor. More... | |
| (int) | - getDescriptorSize |
| Gets the descriptor's size. More... | |
| (int) | - extractDescriptor:withImage:withDescriptor: |
| Extracts the face descriptor for face recognition from a facial image. More... | |
| (float) | - descriptorsSimilarity:withSecondDescriptor: |
| Calculates similarity between two descriptors. More... | |
| (int) | - addDescriptor:withFaceData:withName: |
| Extracts a face descriptor from the input RGB, RGBA or grayscale image and adds it to the gallery. More... | |
| (int) | - addDescriptor:withName: |
| Adds face descriptor to the gallery. More... | |
| (int) | - getDescriptorCount |
| Gets number of descriptors in the gallery. More... | |
| (int) | - getDescriptorName:withIndex: |
| Gets the name of a descriptor at the given index in the gallery. More... | |
| (int) | - replaceDescriptorName:withIndex: |
| Replaces the name of a descriptor at the given index in the gallery with new name. More... | |
| (int) | - removeDescriptor: |
| Removes a descriptor at the given index from the gallery. More... | |
| (int) | - saveGallery: |
| Save gallery as a binary file. More... | |
| (int) | - loadGallery: |
| Load gallery from a binary file. More... | |
| (void) | - resetGallery |
| Clear all face descriptors from the gallery. | |
| (int) | - recognize:withNameCount:withNames:withSimilarities: |
| Compare a face to all faces in the current gallery and return n names of the most similar faces. More... | |
Objective-C wrapper of the VisageSDK::VisageFaceRecognition class.
Definition at line 22 of file objc_VisageFaceRecognition.h.
| - (int) addDescriptor: | (VisageImage *) | image | |
| withFaceData: | (FaceData *) | faceData | |
| withName: | (NSString *) | name | |
Extracts a face descriptor from the input RGB, RGBA or grayscale image and adds it to the gallery.
| image | VisageImage pointer that contains the input RGB, RGBA or grayscale image. The image should contain only one face and this face will be added to the gallery. In case of multiple faces in the image, it is not defined which face would be used. |
| facedata | facial data obtained from VisageTracker or VisageFeaturesDetector. |
| name | name of the face in the image. |
| - (int) addDescriptor: | (short *) | descriptor | |
| withName: | (NSString *) | name | |
Adds face descriptor to the gallery.
| descriptor | descriptor to be added to the gallery obtained by calling extractDescriptor. |
| name | name of the descriptor. |
| - (float) descriptorsSimilarity: | (short *) | firstDescriptor | |
| withSecondDescriptor: | (short *) | secondDescriptor | |
Calculates similarity between two descriptors.
The function returns a float value between 0 and 1. Two descriptors are equal if the similarity is 1. Two descriptors are completely different if the similarity is 0.
| first_descriptor | pointer to the first descriptor, an array of DESCRIPTOR_SIZE Int16 values. |
| second_descriptor | pointer to the second descriptor, an array of DESCRIPTOR_SIZE Int16 values. |
| - (int) extractDescriptor: | (FaceData *) | faceData | |
| withImage: | (VisageImage *) | image | |
| withDescriptor: | (short *) | descriptor | |
Extracts the face descriptor for face recognition from a facial image.
Prior to using this function, it is necessary to process the facial image or video frame using VisageTracker or VisageFeaturesDetector and pass the obtained facial data to this function.
Example:
| facedata | facial data obtained from VisageTracker or VisageFeaturesDetector. |
| image | VisageImage pointer to the input RGB, RGBA or grayscale image. |
| descriptor | pointer to a DESCRIPTOR_SIZE-dimensional array of Int16. The resulting face descriptor is returned in this array. |
See also: FaceData, VisageTracker, VisageFeaturesDetector
| - (int) getDescriptorCount |
Gets number of descriptors in the gallery.
| - (int) getDescriptorName: | (NSMutableString *) | name | |
| withIndex: | (int) | index | |
Gets the name of a descriptor at the given index in the gallery.
| name | buffer into which the name of a descriptor is filled. |
| index | index of descriptor in the gallery. |
| - (int) getDescriptorSize |
Gets the descriptor's size.
The function returns size of an array which should be allocated for storing the descriptor.
| - (VisageFaceRecognition *) init: | (NSString *) | dataPath |
Constructor.
| dataPath | path to the data file required for face recognition - fr.tflite provided in Samples/data/vfr. |
| - (int) loadGallery: | (NSString *) | fileName |
Load gallery from a binary file.
The entries from the loaded gallery are appended to the current gallery. If it is required to replace existing gallery with the loaded one, call resetGallery first.
| file_name | name of the file (including path if needed) from which the gallery will be loaded. |
| - (int) recognize: | (short *) | descriptor | |
| withNameCount: | (int) | n | |
| withNames: | (NSMutableArray *) | names | |
| withSimilarities: | (NSMutableArray *) | similarities | |
Compare a face to all faces in the current gallery and return n names of the most similar faces.
Example:
| descriptor | pointer to the face descriptor of the face to be recognized (compared to the gallery). |
| n | number of names and similarities to be returned. |
| names | NSMutableArray. In this array the function will return names of n faces from the gallery that are most similar to the input image ascending by similarity. |
| similarities | NSMutableArray. The function will return the similarity values for the n most similar faces in this array, corresponding to the names array. The values are sorted, with the largest similarity value first. |
| - (int) removeDescriptor: | (int) | index |
Removes a descriptor at the given index from the gallery.
The remaining descriptors in the gallery above the given index (if any) are shifted down in the gallery array by one place, filling the gap created by removing the descriptor.
| index | index of descriptor in the gallery. |
| - (int) replaceDescriptorName: | (NSString *) | name | |
| withIndex: | (int) | index | |
Replaces the name of a descriptor at the given index in the gallery with new name.
| name | new descriptor name. |
| index | index of descriptor in the gallery. |
| - (int) saveGallery: | (NSString *) | fileName |
Save gallery as a binary file.
| file_name | name of the file (including path if needed) into which the gallery will be saved |
1.8.15