Jump to content
  • Advertisement
Sign in to follow this  
AhmedSaleh

OpenGL 2D Into 3D Problem

This topic is 2529 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've drew an N*N 3D Cubes using Opengl, and they were textured by a frame from the webcam using opencv. I would like to add motion tracking for the whole frame, for only specific cubes, based on that, the affected grid of cubes should move in/out in the Z Plane. I don't know what is the best approach for achieving that effect.

Share this post


Link to post
Share on other sites
Advertisement
OK, Suppose you have a matrix of cubes N*N, those cubes are textured using the web cam image, which is extracted by OpenCV , so that I can see my full Image on the N*N Cubes. Now I would like to extract from one frame, which parts of the tiles had movement, for example the 1*8 Matrix, that part of cubes should move out in the Z Plane and so on for other cubes. So the problem is how do I detect part of the webcam image for movement, then translate these information into movement of the cubes.

Share this post


Link to post
Share on other sites
Whatever you do is going to involve computing an optical flow vector field. The Wikipedia article describes a number of methods; I kind of like the Horn-Schunck method, though Lucas-Kanade is faster, and maybe more widely used. In the OpenCV documentation, see the functions whose names start with "cvCalcOpticalFlow," e.g. cvCalcOpticalFlowHS for Horn-Schunck or cvCalcOpticalFlowPyrLK for a souped-up version of Lucas-Kanade. You'll get as output motion vectors; see e.g. this Youtube video.

Once you have motion vectors, then you can combine them in various ways to determine how to move your cubes. Are you trying to move your cubes in and out along the z axis in some arbitrary way just to say "this area had motion," or are you trying to sort of "reconstruct" the 3d object from the video? If it's the former, then you have lots of easy options; e.g., you can compute an average, or find the largest motion vector, etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!