ofxCvColorImage can convert ofImage?

I want to take a special frame in ofVideoPlayer to generated a ofimage.

unsigned char *  pixelColor =  VideoPlayer>getPixels();  
ofTexture texColor = loadData(pixelColor,VideoPlayer>getWidth(),VideoPlayer->getHeight(),GL_RGB);  
ofPixels  tmp;  

if ofxCVColorImage can convertd to ofimage,I think the process is easier.

ofxCvColorImage cvImg;  
ofImage myImg = cvImg; Error........  

You can grab a texture from an ofxCvImage using getTextureReference() and then draw that:

ofTexture tex = cvImage.getTextureReference();  

or you can grab the pixels from the ofxCvImage and add those to an ofImage

ofImage img;  

Hope that helps a little bit.

as this does, it’s simplier.

also if you just want to go from ofVideoPlayer -> ofImage you can do:

ofImage img;  

Oh my god !

thank you very much ! arturo !

I love OF !!

[quote=“arturo, post:4, topic:8318”]
also if you just want to go from ofVideoPlayer -> ofImage you can do:[/quote]

Based on ofxCvImage documentation (base class for ofxCvColorImage):

If I understand correctly, I should be able to do this (verified bUseTexture = true):


However, it does’nt work for me and so I must do this in order to reference myCvColorImage texture:

ofImage img;  

In regards to myCvColorImage.getTextureReference().bind();:
Do I need to reload the myCvColorImage or something ?

yes that should work, which problem are you having?

Thanx for the quick reply, sorry for my delayed reponse…

I was getting a garbled-garbage image ; incomplete pixel image, noise, etc. (sorry I forgot to mention this!)

I resolved the problem by updating the CvColorImage texture since I was manipulating it and then drawing it via openGL :

myCvColorImage *= otherCvColorImage;