ofFbo to ofxCvGrayscaleImage

Hey!

I am having problems with transforming ofFbo to ofxCvGrayscaleImage.

  
  
ofFbo::Settings settings;  
settings.width = 640;   
settings.height = 480;  
settings.internalformat = GL_RGBA;      
settings.numSamples = 0;  
settings.useDepth = false;     
settings.useStencil = false;  
m_fbo.allocate(settings);  
m_fbo.begin();  
ofClear(0, 0, 0);    
ofFill();  
ofSetColor(255, 255, 255, 0);  
ofCircle(200, 200, 50);  
m_fbo.end();  
ofPixels pixels;  
m_fbo.readToPixels(pixels);  
  
ofImage imgMask;  
imgMask.setImageType(OF_IMAGE_GRAYSCALE);    
imgMask.setFromPixels(pixels);  
  
ofxCvGrayscaleImage gscMask;  
gscMask.allocate(pixels.getWidth(), pixels.getHeight());  
gscMask.setFromPixels(pixels.getPixels(),pixels.getWidth(), pixels.getHeight());   
  

If I draw the ofImage is fine, while with gscMask everything is black. I need the ofxCvGrayscaleImage because later I am doing all kinds of stuff with it…

i don’t know how it works internally ofxCvGrayscaleImage… but i suppose with GL_LUMINANCE, have you tried to set:

settings.internalformat = GL_LUMINANCE;

instead of

settings.internalformat = GL_RGBA;