VideoFrame class


This class offers a convenient way to convert the video frames received by a Kinect sensor into an openGL texture. A VideoFrame can be used along with the DepthMap class in order to display a 3D textured surface parameterized as a quadratic mesh (for more technical details you can read IEEE Transactions on Cybernetics, 2013, or watch the VIDEO DEMO). The openGL rendering is performed using JogAmp's JOGL Java library, which is required in the VideoFrame class.

This class is part of the J4K library, which is included in the University of Florida Digital Worlds (ufdw.jar) Java library. This library was developed by Prof. Angelos Barmpoutis, and further extended by the students and faculty who work in the SAGE program (Serious and Applied Gaming Environments) at the Digital Worlds Institute. You can find more information about how to join our graduate and undergraduate programs at this link (www.digitalworlds.ufl.edu).

If you use this Java library in your research, please cite the following article, which introduced this library:
A. Barmpoutis. 'Tensor Body: Real-time Reconstruction of the Human Body and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, Special issue on Computer Vision for RGB-D Sensors: Kinect and Its Applications, October 2013, Vol. 43(5), Pages: 1347-1356. Download PDF - Kinect Avatars paper [VIDEO DEMO]


package edu.ufl.digitalworlds.j4k;

public class VideoFrame {

The following methods construct a new VideoFrame object.


    /*This method constructs a default VideoFrame with no content.*/
    public VideoFrame();
    
    /*This method constructs a default VideoFrame with no content
      and is associated with a given openGL texture ID.*/

    public VideoFrame(int openGLTexture_ID);

You can update the contents of the video frame, bind it in openGL, or delete its openGL texture reference using the following methods.


    /*This method updates the contents of the VideoFrame with the
      given data in BGRA format.*/

    public void update(int width, int height, byte[] data);
    
    /*This method updates the contents of the VideoFrame by
      passing an object of type java.awt.image.BufferedImage.*/

    public void update(BufferedImage img);
    
    /*This method binds the openGL texture of this VideoFrame so 
      that it will be used when rendering the next 3D object.*/

    public void use(GL2 gl);

    /*This method method deletes the openGL texture from the
      memory and releases its texture ID.*/

    public void deleteGLTexture(GL2 gl);

The following methods return the current value of various parameters of a VideoFrame object.


    /*This method returns the width of the current video frame.*/
    public int getWidth();

    /*This method returns the height of the current video frame.*/
    public int getHeight();

    /*This method returns the openGL texture ID associated with
      this VideoFrame object.*/

    public int getOpenGLTextureID();    

You can access the current pixel values of a video frame by using the following public array.


    /*This following array contains the current content of the
      VideoFrame in BGRA format. Use the update() method if you
      change its contents.*/

    byte[] data=null;    
}

What to do next:
  • You can download several source code examples from the Source Code Examples website.
  • You can also read a brief tutorial on "How to write your own Kinect-Java programs".


  • Disclaimer: The names JAVA and KINECT and their associated logos are trademarks of their respective copyright owners Oracle and Microsoft. None of these companies endorse, fund, or are in any way associated with the J4K library.

    Disclaimer: This software is provided for free without any warranty expressed or implied for academic, research, and strictly non commercial purposes only. By downloading this library you accept the Terms and Conditions.

    University of Florida, Digital Worlds Institute, P.O.Box 115810, 101 Norman Gym, Gainesville, FL 32611-5810, USA