Generating ofMeshes from video feed

So I was really inspired by Michael Hadley’s tutorial on generating meshes from images, and I got the idea of generating a dynamic one based on a video input. I’m a fairly experienced programmer, but still new to the world of graphics, OpenGl, and meshes.

Could someone point me in the right direction as to how to achieve this? For example which classe(es) of OF should I familiarize myself with? Will such a project require me to use Shaders?

Lastly, and if this is a vague question I understand if you ignore it, is it possible to generate meshes form images based upon blob detection by OpenCV?

Many Thanks,


I recommend you to start with the 3d/meshFromCamera,

graphics/polylineBlobsExample and addons/opencvExample, from the examples folder.

If you really want to play around with openCV in OF, you should check Kyle Mcdonalds’ ofxCv. It’s more up-to-date and with much more examples. Also, you can check the addons website to get more approaches.

Have fun!

Those example really help. Thank you!

Hey @satre, did you get anywhere with the video ofmesh generation? Been playing around with this and looking at the meshfromcamera example. Id love to see how you did it.

Hi @80l08, I did have some luck with this. It’s actually not that difficult. Unfortunately, I don’t have the code around with me anymore. Basically, it boils down to extracting the texture for the videograbber and applying it to the mesh. You can get a reference to the texture that contains the live video stream from the getTexture() method on ofVideoGrabber. If you bind() this texture when you draw your mesh, OF should take care of the rest and the image should draw into the mesh. There might be a couple other things I’m forgetting, but that is most of it.

Hope that helps!

P.S. don’t forget to unbind your texture when you’re done drawing.

hey, sorry for the late reply. I got it working, but the initial tries didn’t look as exciting as I thought they might. Will keep playing! Many thanks for the tips!