Hi ,
I hope someone can help or point me in the right direction.
The aim of this is to capture 3d objects in a scene and pass the 2d data from the drawn scren through to OpenCV contourFinder to get out the blobs. This works fine but in the routine below readToPixels has a huge impact on the FPS 300 fps down to 30. Is there a faster way to do this?
Definitions:
ofTexture tex3D;
ofPixels tex3DPixels;
ofxCvGrayscaleImage grayImg;
Inside draw:
glEnable(GL_DEPTH_TEST);
camera.begin();
ofPushMatrix();
//---------------------------------------------------------------------------
ofSetColor(255,255,255);
ofTranslate(-models.getPosition().x, -models.getPosition().y, -models.getPosition().z);
models.drawFaces();
ofPopMatrix();
camera.end();
tex3D.loadScreenData(0,0,textW,textH);
tex3D.readToPixels(tex3DPixels);
tex3DPixels.resize(textW/2,textH/2);
grayImg.setFromPixels(tex3DPixels);
grayImg.mirror(true,false); // costs 5fps
contourFinder.findContours( grayImg, minArea, maxArea, maxBlobs, true); // find holes
Thanks in advance