ofxCv, Mat::zeors does not show a black image

hi, sorry for my bad english
i’m try to use the supercool addons ofxCv, i love how it is designed!

but, with some testing i had some problems.
the first is that toOf does not work for converting cv::Mat to ofImage. i resolved with this snippet:

  
setFromPixels(debug.data, 320,240, OF_IMAGE_GRAYSCALE);  

but probabilly it doesn’t work correctly…

this is a little sketch for explain the problem. i try to create some stuffs in opencv (a plain black image), then cast it back to ofImage, and show it.
the problem is that when i show after the cast, there is no what i am expecting (a plain black image) but some flickering, noises and glitches.
here it is:

testApp.h

  
#pragma once  
  
#include "ofMain.h"  
#include "ofxCv.h"  
  
  
class testApp : public ofBaseApp {  
public:  
	void setup();  
	void update();  
	void draw();  
  
    ofVideoGrabber vidGrabber;  
    ofImage colorImg;  
    ofImage foo;  
};  

testApp.cpp

  
#include "testApp.h"  
  
using namespace ofxCv;  
using namespace cv;  
  
void testApp::setup() {  
    vidGrabber.setVerbose(true);  
    vidGrabber.initGrabber(320,240);  
  
    colorImg.allocate(320,240, OF_IMAGE_COLOR);  
    foo.allocate(320,240, OF_IMAGE_COLOR);  
}  
  
  
void testApp::update() {  
    bool bNewFrame;  
  
    vidGrabber.grabFrame();  
    bNewFrame = vidGrabber.isFrameNew();  
  
    if (bNewFrame){  
        colorImg.setFromPixels(vidGrabber.getPixels(), 320, 240, OF_IMAGE_COLOR);  
    }  
}  
  
void testApp::draw() {  
    cv::Mat debug = cv::Mat( 320,240, CV_8UC3 );  
    cv::Mat::zeros(320,240, CV_32FC3);  
    // toOf(debug, grayImg2); // don't compilw because toOf call setFromExternalPixels and ofImage has setFromPixels that is a little different  
    foo.setFromPixels(debug.data, 320,240, OF_IMAGE_GRAYSCALE);  
  
  
    colorImg.draw(0,0);  
    foo.draw(320,0);  
}  

in this simple sketch the foo.draw show black with some flickering, but if in update i do more things it flickers a lot.

if all you want is do some cv stuff and then display it, then you will not need to convert it back to an ofImage. You can use drawMat to draw a cv::Mat();

Mat dst;
copy(vidGrabber,dst);
drawMat(dst,320,0);

ohu yeah, i’ve seen it in the meanwhile, and i’m going in not use anymore ofImage but only cv::Mat…

buy i still don’t unserstand why that error happened…

ok i think it is about the need to blind texture