Face in hole - face tracking

Hi,

I’m trying to create a face in the hole board effect using face tracking but couldn’t really figure out how to go about it. I started off playing around with ofxcv and understand how to get an image to follow and scale to your face but how instead of just the image scaling you want the blank space to follow and scale to your face.

Kind of like a mask.

This is probably quite simple but I haven’t programmed in ages and just got back to it.

Any ideas would be great!

Did you try the face tracking examples in ofxCv?

Hey thanks for your reply,
I’ve had a look at the face follow examples but now trying to work out to create a texture out and map it on the mesh that’s following the face.

I’ve played around with the ofxFaceTracker calibration example and trying to create a mask however keep getting a grey screen when the mask is being applied. The mapping works with a Circle but has trouble when it’s following the face.

void ofApp::draw()
{
ofSetColor(255);

if(tracker.getFound())
{
    calibration.getDistortedIntrinsics().loadProjectionMatrix();
    
    glEnable(GL_BLEND);
    glColorMask(false, false, false, true);
    glBlendFunc(GL_SRC_ALPHA, GL_ZERO);
    glColor4f(0.5,0.5,1,0.5f);

// ofCircle(200, 200, 200); // This works fine as a mask but is a bit heavy

    physicalMesh.drawFaces();
    
    glColorMask(true,true,true,true);
    glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA);
    glColor4f(1,0,0,1.0f);
}

cam.draw(0, 0);

}

I’m trying to create a face in the hole board effect using face tracking but couldn’t really figure out how to go about it. I started off playing around with ofxcv and understand how to get an image to follow and scale to your face but how instead of just the image scaling you want the blank space to follow and scale to your face.


waleeed

bakercp’s suggestions seems the best fit.
I used the example-face-follow in ofxCv and just had it load in a different png.
Now all you have to do is make a PNG that is totally transparent in the middle.
The scaling to the size of the face already happens in the code.