OpenCV for Unity  2.6.3
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.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
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...

Inheritance diagram for OpenCVForUnity.FaceModule.MACE:
OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

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

Static Public Member Functions

static new MACE __fromPtr__ (IntPtr addr)
 
static MACE load (string filename, string objname)
 constructor More...
 
static MACE load (string filename)
 constructor More...
 
static MACE create (int IMGSIZE)
 constructor More...
 
static MACE create ()
 constructor More...
 
- 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.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- 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:

Ptr&lt;face::MACE&gt; mace = face::MACE::create(64);
vector&lt;Mat&gt; pos_images = ...
mace-&gt;train(pos_images);
Mat query = ...
bool same = mace-&gt;same(query);

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

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

save/load your model:

Ptr&lt;face::MACE&gt; mace = face::MACE::create(64);
mace-&gt;train(pos_images);
mace-&gt;save("my_mace.xml");
// later:
Ptr&lt;MACE&gt; reloaded = MACE::load("my_mace.xml");
reloaded-&gt;same(some_image);

Member Function Documentation

◆ __fromPtr__()

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

◆ create() [1/2]

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

constructor

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

◆ create() [2/2]

static MACE OpenCVForUnity.FaceModule.MACE.create ( )
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,
string  objname 
)
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)
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: