OpenCV for Unity 2.6.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.FaceModule.MACE Class Reference

Minimum Average Correlation Energy Filter useful for authentication with (cancellable) biometrical features. (does not need many positives to train (10-50), and no negatives at all, also robust to noise/salting) More...

Public Member Functions

void salt (string passphrase)
 optionally encrypt images with random convolution
 
bool same (Mat query)
 correlate query img and threshold to min class value
 
void train (List< Mat > images)
 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
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual string getDefaultName ()
 
IntPtr getNativeObjAddr ()
 
void save (string filename)
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new MACE __fromPtr__ (IntPtr addr)
 
static MACE create ()
 constructor
 
static MACE create (int IMGSIZE)
 constructor
 
static MACE load (string filename)
 constructor
 
static MACE load (string filename, string objname)
 constructor
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Minimum Average Correlation Energy Filter useful for authentication with (cancellable) biometrical features. (does not need many positives to train (10-50), and no negatives at all, also robust to noise/salting)

see also: [Savvides04]

this implementation is largely based on: https://code.google.com/archive/p/pam-face-authentication (GSOC 2009)

use it like:

@iverbatim
Ptr<face::MACE> mace = face::MACE::create(64);
vector<Mat> pos_images = ...
mace->train(pos_images);
Mat query = ...
bool same = mace->same(query);
@endiverbatim
n-dimensional dense array class
Definition Mat_ValueTuple.cs:11
bool same(Mat query)
correlate query img and threshold to min class value
Definition MACE.cs:147

you can also use two-factor authentication, with an additional passphrase:

String owners_passphrase = "ilikehotdogs";
Ptr<face::MACE> mace = face::MACE::create(64);
mace->salt(owners_passphrase);
vector<Mat> pos_images = ...
mace->train(pos_images);
// now, users have to give a valid passphrase, along with the image:
Mat query = ...
cout << "enter passphrase: ";
string pass;
getline(cin, pass);
mace->salt(pass);
bool same = mace->same(query);

save/load your model:

Ptr<face::MACE> mace = face::MACE::create(64);
mace->train(pos_images);
mace->save("my_mace.xml");
// later:
Ptr<MACE> reloaded = MACE::load("my_mace.xml");
reloaded->same(some_image);
static MACE load(string filename, string objname)
constructor
Definition MACE.cs:171

Member Function Documentation

◆ __fromPtr__()

static new MACE OpenCVForUnity.FaceModule.MACE.__fromPtr__ ( IntPtr addr)
static

◆ create() [1/2]

static MACE OpenCVForUnity.FaceModule.MACE.create ( )
static

constructor

Parameters
IMGSIZEimages will get resized to this (should be an even number)

◆ create() [2/2]

static MACE OpenCVForUnity.FaceModule.MACE.create ( int IMGSIZE)
static

constructor

Parameters
IMGSIZEimages will get resized to this (should be an even number)

◆ Dispose()

override void OpenCVForUnity.FaceModule.MACE.Dispose ( bool disposing)
protectedvirtual

◆ load() [1/2]

static MACE OpenCVForUnity.FaceModule.MACE.load ( string filename)
static

constructor

Parameters
filenamebuild a new MACE instance from a pre-serialized FileStorage
objname(optional) top-level node in the FileStorage

◆ load() [2/2]

static MACE OpenCVForUnity.FaceModule.MACE.load ( string filename,
string objname )
static

constructor

Parameters
filenamebuild a new MACE instance from a pre-serialized FileStorage
objname(optional) top-level node in the FileStorage

◆ salt()

void OpenCVForUnity.FaceModule.MACE.salt ( string passphrase)

optionally encrypt images with random convolution

Parameters
passphrasea crc64 random seed will get generated from this

◆ same()

bool OpenCVForUnity.FaceModule.MACE.same ( Mat query)

correlate query img and threshold to min class value

Parameters
querya Mat with query image

◆ train()

void OpenCVForUnity.FaceModule.MACE.train ( List< Mat > images)

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

Parameters
imagesa vector<Mat> with the train images

The documentation for this class was generated from the following file: