0

I am using Camera.Face to detect face and min3D to load 3d models.

I want to let the model move with face, but it is not working well.

@Override
public void updateScene() {
    if (mFaces == null) {

        animeModel.position().x = animeModel.position().y = animeModel
                .position().z = 0;
        return;
    }
    for (Face face : mFaces) {
        if (face == null) {
            continue;
        }
        animeModel.position().x = face.rect.centerX();
        animeModel.position().y = face.rect.centerY();
    }
}

Is that model's coordinate and rectangle's coordinate are different systems?

(world coordinates to screen coordinates or something?)

How to solve this?

UPDATE:

enter image description here

I have try to get model's coordinate and face's coordinate.

These two value are totally different.

How to convert face.rect.centerX() to animeModel.position().x?

Ayane.T
  • 45
  • 7

1 Answers1

0

Here is an article all about how a face tracking demo was developed:

http://www.smallscreendesign.com/2011/02/07/about-face-detection-on-android-%E2%80%93-part-1/

That app is also available on the Play store. Part 1 of the above article has some performance metrics on recognition time. It looks like it may take up to two seconds or more to detect a face.

You could use the code in that article to do your prototyping. You may discover that face detection doesn't happen fast or often enough to track a face in realtime.

Here is the documentation for face tracking on the Android Developer site: http://developer.android.com/reference/android/hardware/Camera.Face.html

UPDATE:

Check out this library: https://code.google.com/p/asmlib-opencv/

Dave Swersky
  • 34,502
  • 9
  • 78
  • 118