kylemcdonald/ofxFaceTracker

getObjectMesh() work but, getImageMesh() Not working

aisgirish opened this issue · 2 comments

Hi,
I am developing iOS app. I need to detect two person's face and swapped them.
I can detect and swap faces using getObjectMesh() but it give me weird face's vertices. So, they look ugly.

So, I try with getImageMesh(). But it stop showing cropped faces on screen. May be they change it's location.

My code for swapped faces.
```
// FIRST FACE
ofVec2f position = rightTrackerThread.getPosition();

    float scale = rightTrackerThread.getScale();
    ofVec3f orientation = rightTrackerThread.getOrientation();

    ofPushMatrix();      
    ofTranslate(position.x, position.y);        
    ofScale(scale, scale, scale);

    ofRotateX(orientation.x * 45.0f);
    ofRotateY(orientation.y * 45.0f);
    ofRotateZ(orientation.z * 45.0f);
    ofSetColor(255,255,255,255);

    leftSideImage.bind();
    leftMesh.draw();
    leftSideImage.unbind();
    ofPopMatrix();

  // SECOND FACE
    ofVec2f position2 = leftTrackerThread.getPosition();

    float scale2 = leftTrackerThread.getScale();
    ofVec3f orientation2 = leftTrackerThread.getOrientation();

    ofPushMatrix();       
    ofTranslate(position2.x, position2.y);       
    ofScale(scale2, scale2, scale2);

    ofRotateX(orientation2.x * 45.0f);
    ofRotateY(orientation2.y * 45.0f);
    ofRotateZ(orientation2.z * 45.0f);
    ofSetColor(255,255,255,255);

    rightSideImage.bind();
    rightMesh.draw();
    rightSideImage.unbind();
    ofPopMatrix();
Result image with getObjectMesh().
![img_1441](https://cloud.githubusercontent.com/assets/17251877/14977933/fbce9f44-1135-11e6-84bc-0897242baf61.jpg)

Oh there is my mistake.
We don't need to write any code for rotation or translate.

ofPushMatrix();  
leftSideImage.bind();
leftMesh.draw();
leftSideImage.unbind();
ofPopMatrix();

ofPushMatrix();
rightSideImage.bind();
rightMesh.draw();
rightSideImage.unbind();
ofPopMatrix();

We don;t need to write code rotation when we use getImageMesh() function.