clones vs images - manipulating a facesubstitution image further after overlaying a face #5

Open
heaversm opened this Issue Mar 31, 2013 · 3 comments

Projects

None yet

2 participants

@heaversm

Hi - I'm trying to figure out how to add additional manipulations to FaceSubstitution after it overlays a face using James George's ofxSlitscan. Slitscan takes an image, but it seems that the final result of FaceSubstitution is a Clone (for which I can't really find documentation).

in the update function, there is the folowing code:

if(cam.isFrameNew()) {

        camTracker.update(toCv(cam));

        cloneReady = camTracker.getFound();
        if(cloneReady) {
            ofMesh camMesh = camTracker.getImageMesh();
            camMesh.clearTexCoords();
            camMesh.addTexCoords(srcPoints);

            maskFbo.begin();
            ofClear(0, 255);
            camMesh.draw();
            maskFbo.end();

            srcFbo.begin();
            ofClear(0, 255);
            src.bind();
            camMesh.draw();
            src.unbind();
            srcFbo.end();

            clone.setStrength(16);
            clone.update(srcFbo.getTextureReference(), cam.getTextureReference(), maskFbo.getTextureReference());
        }

Once this is done, that clone is drawn to screen in the draw function:

clone.draw(0, 0);

So I'm assuming that during the update function, I need to take the clone, and convert it into an image that I can pass to slitscan. That process normally goes as follows:

In update:

slitscan.addImage(cam);

where cam is the webcam image (ofGrabber) and addImage takes an ofImage type

and draw:

slitScan.getOutputImage().draw(0, 0);

Any idea how to take that clone and convert it to an image that can be passed to slitscan.addImage?

Owner

Off the top of my head, I think clone is an ofFbo and it has a function called something like readbackPixels or similar that will retun pixels you can load into an ofImage.

Ah - I found Clone - no readbackPixels - just an update and draw function, where the draw function draws to "buffer" which is an Fbo.

Owner

ofFbo::readToPixels() is what you want. going to close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment