ofSimpleGuiToo - Showing ofCvColorImage, ofCvGrayscaleImage.

Hi guys,

I was wondering what’s the best way to show elements like ofCvColorImage or ofCvGrayscaleImage inside ofSimpleGuiToo.

I tried showing a texture with videoGrabber.getPixels and it works but I’m not sure on how to do it with ofCvColorImage and ofCvGrayscaleImage. I tried to apply the same method but it does some funny stuff like cropping the image or showing it multiple times inside ofSimpleGuiToo’s element.

trackerColorImageTexture.loadData(trackerColorImage.getPixels(), trackerVideoGrabber.getWidth(), trackerVideoGrabber.getHeight(), GL_RGB);  

Thanks in advance

or even
in fact anything that is drawable (i.e. extends ofBaseDraws) can be passed into gui.addContent

one warning though, the object must be allocated before you call addContent,

Thanks for your reply.

I use:

ofCvColorImage  trackerColorImage;  

trackerColorImage.allocate( trackerWidth, trackerHeight );  

gui.addContent("trackerColorImage", trackerColorImage);  

but get this error:

error: no matching function for call to 'ofxSimpleGuiToo::addContent(ofCvColorImage&)'  

As if passing an ofCvColorImage as a parameter was not allowed. Hence my question about textures.

weird, could you have a look at ofxCvImage.h, does ofxCvImage extend ofBaseImage?

class ofxCvImage : public ofBaseImage  

if not you probably have an older version of openframeworks and/or ofxOpenCv

Mine doesn’t extend it so that might be why. How funny, I’ll double check what’s going on.

Thank you :slight_smile: