OpenCV  3.4.12
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::face::MACE Class Referenceabstract

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

#include <opencv2/face/mace.hpp>

Inheritance diagram for cv::face::MACE:
cv::Algorithm

Public Member Functions

virtual void salt (const cv::String &passphrase)=0
 optionally encrypt images with random convolution More...
 
virtual bool same (cv::InputArray query) const =0
 correlate query img and threshold to min class value More...
 
virtual void train (cv::InputArrayOfArrays images)=0
 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...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Static Public Member Functions

static cv::Ptr< MACEcreate (int IMGSIZE=64)
 constructor More...
 
static cv::Ptr< MACEload (const String &filename, const String &objname=String())
 constructor More...
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

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: [185]

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

use it like:

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

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);

Member Function Documentation

◆ create()

static cv::Ptr<MACE> cv::face::MACE::create ( int  IMGSIZE = 64)
static
Python:
retval=cv.face.MACE_create([, IMGSIZE])

constructor

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

◆ load()

static cv::Ptr<MACE> cv::face::MACE::load ( const String filename,
const String objname = String() 
)
static
Python:
retval=cv.face.MACE_load(filename[, objname])

constructor

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

◆ salt()

virtual void cv::face::MACE::salt ( const cv::String passphrase)
pure virtual
Python:
None=cv.face_MACE.salt(passphrase)

optionally encrypt images with random convolution

Parameters
passphrasea crc64 random seed will get generated from this

◆ same()

virtual bool cv::face::MACE::same ( cv::InputArray  query) const
pure virtual
Python:
retval=cv.face_MACE.same(query)

correlate query img and threshold to min class value

Parameters
querya Mat with query image

◆ train()

virtual void cv::face::MACE::train ( cv::InputArrayOfArrays  images)
pure virtual
Python:
None=cv.face_MACE.train(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: