Face reconized

Hi, it is possible to make face reconized with openCV service (i think yes) ?

Do you have an example ?

Thank you.

dom14's picture

It is strange, i found this

It is strange, i found this (function is empty):

public String publishRecognizedFace(String value) {
return value;
public void publishNoRecognizedFace() {
kwatters's picture

face detection vs face recognition

What are you ultimately trying to do?  

the FaceRecognizer filter can detect a face and then give a label to that face for the most probably match that it knows about.  This means that it must be trained to learn who various people are.  Once the filter is trained, it will publish when it detects a face, and it will publish that value via the OpenCV service.

So, you can subscribe to this event in python by subscribing to the pubilshFaceRecognizedFace method...

Ignore the publishNoRecognizedFace method as that's less useful.

GroG's picture

In the MyRobotLab API -

In the MyRobotLab API - http://myrobotlab.org/content/myrobotlab-api

{publish} methods are events which can be subscribed to.

When one thread "invokes" a method in a Mrl Service - any subscribers get a callback with the returned data.

So you 


When OpenCV can no longer find a recognized face, it will invoke publishNoRecognizedFace.  Your service which subscribed to this event will get it's callback called.

public void onNoRecognizedFace() { <---  your event handler
        log.info("HELP I DON'T RECOGNIZE ANYONE !");

In the case of publishNoRecognizedFace there is no data with the event, so the publish method only publishes the event.  That is why the method is "empty"

However, with publishRecognizedFace returns and takes a string as a parameter.  So this even has a String associated with it.  It's probably the person it recognized.  Your service could subscribe to this event in a similar way.


Again, in you service you would create a callback method to do what you want when a face was recognized.

public void publishRecognizedFace(String name) { <---  your event handler
        log.info("Hi " + name + " I recognized you ! ");

The simple algorithm to match callbacks is consistent through all of Mrl.

If there is a publish{Method}(PType0, PType1, ...)
The expected callback is on{Method}(PType0, PType1, ...)

dom14's picture

OK i understand. Thank you,

OK i understand.

Thank you, KWatters and Grog.

dom14's picture

but what is the method for

but what is the method for trainning face ?

My aim make database of faces. When opencv reconized face, the bot can do something, depend of person.

For example, if it is reconized me, the bot say "Hello Dominique", if it is reconized my boy, the bot say "Hello Alexis", etc...



dom14's picture

Sorry, sorry, FaceRecognizer

Sorry, sorry, FaceRecognizer always crash MRL.

opencv.addFilter("FaceRecognizer") <-- crash

Strange behaviour, for all mistake, i don't see python exception error, MRL crash directly.


kwatters's picture

send a no worky

without seeing the log files , it's pretty much impossible to tell you what is going on.

you should send a no worky.. that sends your log files so we can review.

dom14's picture

OK, i send you the log

OK, i send you the log file.

But it is not possible to make a noworky because MRL exits.