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

Do you have an example ?

Thank you.


6 years 3 months ago

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

public String publishRecognizedFace(String value) {
return value;
public void publishNoRecognizedFace() {

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.

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

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



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.


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.