i’m trying to draw somes simples rectangles inside an ofxCvGrayscaleImage ,
the image is already loaded with a jpeg , but i want to add a white rectangle over it inside the ofxCvGrayscaleImage
I’ve tried the doc , but can’t understand the workflow before being able to do it
( texture / pixel / framebuffer ??? )
Can anyone point me a simple example ?
You should try ofxCv, I’ve had better experience with that addon. You can use the OpenCV api directly and then use the toCv and toOf methods.
See the examples and readme and you should be good to go!
Thanks for your answer , but i would prefer the native solution available on openframework
forget about the CV part
How can i draw a rectangle inside an ofImage ?
Maybe using an ofFbo?
// load image
// create an fbo that matches the image size
fbo.allocate(img.getWidth(), img.getHeight(), GL_RGB);
ofClear(255, 255, 255, 0);
// draw the image on the fbo
// decorate your image with stuff
ofSetColor(255, 0, 0);
ofDrawRectangle(10, 10, 40, 40);
// transfer the fbo back to the image