Ask Your Question

Using Wavefront OBJ/SPL "meshes" directly in OpenCV

asked 2015-01-09 15:20:31 -0600

updated 2015-01-09 16:42:18 -0600

berak gravatar image

I have a need to "render" a 3d MeshLab produced mesh in OpenCV directly - this can be exported in Waveform obj, ply, stl, off, wrf, dxf, dae, ctm, xyz, gts, json, u3d, idtf or x3d "formats").

At the moment, I'm having to load a .obj file into my C++ application using OpenGL which then "insists" on having a windowing environment to render to (which cannot be provided on the server) - however, I just need a Jpeg or similar file produced (I'll be really happy with having a standard cv::Mat produced)

My question, therefore, is: Is there any way of producing an image file with a 3d mesh within OpenCV itself without the use of third party libraries? [I do have the need to be able to plot it, and other details, in "3d" space]?

edit retag flag offensive close merge delete


why use opencv for this ? do you just need some basic 3d->2d rendering, and did not find anything else ?

berak gravatar imageberak ( 2015-01-09 15:51:14 -0600 )edit

wavefront, not waveform, btw.

berak gravatar imageberak ( 2015-01-09 16:42:41 -0600 )edit

I use OpenCV for the rest of the image processing and manipulation and it made sense to keep it all within OpenCV instead of using even more applications. Thanks for the Wavefront/form correction btw.

richyb gravatar imagerichyb ( 2015-01-09 17:48:55 -0600 )edit

there are ways to render to an off-screen context, unfortunately they are all os specific, and far beyond the scope of this page..

berak gravatar imageberak ( 2015-01-10 05:17:40 -0600 )edit

@richyb have you solved your problem? I have a similar one

marcoE gravatar imagemarcoE ( 2016-04-20 09:41:18 -0600 )edit

Hi, I meet the same problem. Have u solved it?

sublimation gravatar imagesublimation ( 2018-05-15 08:26:22 -0600 )edit

@sublimation , please do not post answers here, if you have a question or comment, thank you.

berak gravatar imageberak ( 2018-05-15 08:34:14 -0600 )edit

OK! I am so sorry for that. Please forgive me,I am only a fresh student and I do not know the rule!

sublimation gravatar imagesublimation ( 2018-05-16 05:02:04 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-01-09 15:43:23 -0600

Have you seen the new Viz module in OpenCV 3.0. I think this could be just what you are looking for.

edit flag offensive delete link more


Thanks - I hadn't (yet). Just looking at it now - does it work without the need to launch a window? (Documentation only shows examples with it)

richyb gravatar imagerichyb ( 2015-01-09 17:50:45 -0600 )edit

oh sorry, I missed that part. The last time I needed to do offscreen rendering, I was using QT but there has to be a simple way just with OpenGL or Glut. Have you tried something like

FooBar gravatar imageFooBar ( 2015-01-10 05:56:26 -0600 )edit

Question Tools

1 follower


Asked: 2015-01-09 15:20:31 -0600

Seen: 2,028 times

Last updated: Jan 09 '15