3D engine in opencv

asked 2017-12-03 09:48:12 -0600

LBerger gravatar image

Hi,

Some thinking about opencv and 3D engine.

Before 3.3 opencv uses as 3D api OpenGL or DirectX and 3D engine Vtk in Viz module. Now in the opencv_contrib OGRE 3D engine is available in OVIS module. Opencv team thinks about a better support for data sets: Deal with Unity or Unreal (2017-11-13). I use openscenegraph in the opencv program. I wonder if I should go on with openscenegraph or may be changed to a new 3D engine for a better compatibility with opencv.

Suggestions about 3d engine in opencv are welcome.

edit retag flag offensive close merge delete

Comments

1

If you are going to use C++, Unreal is the way to go if you want a pre-built engine... Unity requires the use of C#. If you make your engine from scratch, I would use OpenGL or Vulkan instead of Direct3D, so that way the code runs on the maximum number of platforms. If you need help setting up the camera, let me know. What're your target platform(s)?

sjhalayka gravatar imagesjhalayka ( 2017-12-03 11:38:33 -0600 )edit

Thanks for your comment. I'm agree with you about direct 3D. I don't use C# so no unity. From scratch I find it too difficult for me.

Finally OGRE3d and VIZ which is the best module ? or OGRE3D is it equal to VIZ module?

VTk take times to build.

PS I use VS 2015-2017 and windows 10 and raspberry

LBerger gravatar imageLBerger ( 2017-12-03 12:57:48 -0600 )edit

I'm not at all familiar with the OpenCV viz module. I didn't even know it existed. I found some tutorials on it: https://docs.opencv.org/3.3.1/d7/df9/... -- but I can't find a tutorial that draws a triangle mesh.

It looks like the viz module loads and draws point clouds. You can obtain .ply files by using MeshLab. How much more do you want out of an "engine"? If you don't want anything more than that, then you might not need something like OGRE3D or OpenSceneGraph.

I am looking at the documentation for the viz module, and it looks like one of the Camera constructors takes a 4x4 projection matrix, like OpenGL. I have code to get the projection matrix if you need it: http://answers.opencv.org/question/17...

sjhalayka gravatar imagesjhalayka ( 2017-12-03 13:06:15 -0600 )edit

Viz = VTk and Vtk = opengl with high level function

LBerger gravatar imageLBerger ( 2017-12-03 14:06:08 -0600 )edit

Although I don't recommend it, you can always use OpenGL 1.x code to handle setting the projection matrix. With OpenGL 1.x you also can use immediate mode. Here is a minimalistic example of how to load and draw a triangle mesh using OpenGL 1.x: https://github.com/sjhalayka/opengl1_...

Once you've got OpenGL 1.x figured out, then you can upgrade to version 4.x, which forces you to set up your own camera matrix as well as forces you to use vertex buffers in retained mode.

sjhalayka gravatar imagesjhalayka ( 2017-12-03 14:10:38 -0600 )edit

Thanks for the information. :)

sjhalayka gravatar imagesjhalayka ( 2017-12-03 14:25:39 -0600 )edit

About viz

LBerger gravatar imageLBerger ( 2017-12-03 14:51:18 -0600 )edit

So, what technologies are you leaning towards now?

OK, this page is awesome: https://www.vtk.org/features-3d-graph...

I see that VTK was started in part by Bill Lorensen... the guy behind Marching Cubes. :)

sjhalayka gravatar imagesjhalayka ( 2017-12-03 14:59:08 -0600 )edit

Wait and see...

LBerger gravatar imageLBerger ( 2017-12-04 05:01:45 -0600 )edit