public class MACE extends Algorithm
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);
| Modifier | Constructor and Description |
|---|---|
protected |
MACE(long addr) |
| Modifier and Type | Method and Description |
|---|---|
static MACE |
__fromPtr__(long addr) |
static MACE |
create()
constructor
|
static MACE |
create(int IMGSIZE)
constructor
|
protected void |
finalize() |
static MACE |
load(String filename)
constructor
|
static MACE |
load(String filename,
String objname)
constructor
|
void |
salt(String passphrase)
optionally encrypt images with random convolution
|
boolean |
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 |
clear, empty, getDefaultName, getNativeObjAddr, savepublic static MACE __fromPtr__(long addr)
public static MACE create(int IMGSIZE)
IMGSIZE - images will get resized to this (should be an even number)public static MACE create()
public static MACE load(String filename, String objname)
filename - build a new MACE instance from a pre-serialized FileStorageobjname - (optional) top-level node in the FileStoragepublic static MACE load(String filename)
filename - build a new MACE instance from a pre-serialized FileStoragepublic boolean same(Mat query)
query - a Mat with query imagepublic void salt(String passphrase)
passphrase - a crc64 random seed will get generated from thispublic void train(List<Mat> images)
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 imagesimages - a vector<Mat> with the train imagesCopyright © 2020. All rights reserved.