Note that there are some explanatory texts on larger screens.

plurals
  1. POStiching multiple textures/frames together in OpenGL using a Kinect
    primarykey
    data
    text
    <p>I came across the following situation:</p> <ol> <li>I have a Kinect camera and I keep taking frames (but they are stored only when the user presses a key). </li> <li>I am using the <a href="http://openkinect.org/wiki/Main_Page" rel="nofollow">freenect</a> library in order to retrieve the depth and the color of the frame (I am no interested in skeleton tracking or something like that).</li> <li>For a single frame I am using the glpclview example that comes with the freenect <a href="https://github.com/OpenKinect/libfreenect" rel="nofollow">library</a></li> </ol> <p>After retrieving the space data from the Kinect sensor, in the glpclview example, the current frame it is drawn like this:</p> <pre><code>glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_SHORT, 0, xyz); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(3, GL_SHORT, 0, xyz); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, gl_rgb_tex); glTexImage2D(GL_TEXTURE_2D, 0, 3, 640, 480, 0, GL_RGB, GL_UNSIGNED_BYTE, rgb); glPointSize(2.0f); glDrawElements(GL_POINTS, 640*480, GL_UNSIGNED_INT, indices); </code></pre> <p>where </p> <pre><code>static unsigned int indices[480][640]; static short xyz[480][640][3]; char *rgb = 0; short *depth = 0; </code></pre> <p>where:</p> <ul> <li><strong>rgb</strong> is the color information for the current frame</li> <li><strong>depth</strong> is the depth information for the current frame</li> <li><p><strong>xyz</strong> is constructed as : </p> <p>xyz[i][j][0] = j xyz[i][j]<a href="http://openkinect.org/wiki/Main_Page" rel="nofollow">3</a> = i xyz[i][j]<a href="https://github.com/OpenKinect/libfreenect" rel="nofollow">4</a> = depth[i*640+j]</p></li> <li><p><strong>indices</strong> is (I guess only) array that keeps track of the rgb/depth data and is constructed as:</p> <p>indices[i][j] = i*640+j</p></li> </ul> <p>So far, so good, but now I need to render more that just one frame (some of them rotated and translated with a certain angle/offsets). How can I do this? I'ved tried to increase the size of the arrays and keep reallocationg memory for each new frame, but how can I render them? Should I change this current line to something else? </p> <pre><code>glTexImage2D(GL_TEXTURE_2D, 0, 3, 640, 480, 0, GL_RGB, GL_UNSIGNED_BYTE, rgb) </code></pre> <p>If so, to what values should I change 640 and 480 since now <strong>xyz</strong> and <strong>rgb</strong> is a contiguos pointer of 640x480x(number of frames)? </p> <p>To get a better ideea, I am trying to get something similar to <a href="http://www.youtube.com/watch?v=9Y4RQVpp-BY&amp;feature=related" rel="nofollow">this</a> in the end (except the robot :D ).</p> <p>If somewone has a better ideea, hint anything on how I should approach this problem, please let me know. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload