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:


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


#include "testApp.h"  
using namespace ofxCv;  
using namespace cv;  
void testApp::setup() {  
    colorImg.allocate(320,240, OF_IMAGE_COLOR);  
    foo.allocate(320,240, OF_IMAGE_COLOR);  
void testApp::update() {  
    bool bNewFrame;  
    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);  

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;

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