Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st

Difference between revisions of "C Sync Wrapper"

From OpenKinect
Jump to: navigation, search
(Interface)
(Interface)
Line 13: Line 13:
 
#define DEPTH_BYTES 614400 // 480 * 640 * 2                                                                                   
 
#define DEPTH_BYTES 614400 // 480 * 640 * 2                                                                                   
 
#define RGB_BYTES 921600  // 480 * 640 * 3                                                                                     
 
#define RGB_BYTES 921600  // 480 * 640 * 3                                                                                     
int freenect_get_rgb(char **rgb, uint32_t *timestamp);
+
    int freenect_get_rgb(char **rgb, uint32_t *timestamp);
 
     Synchronous rgb function, starts the runloop if it isn't running                                                           
 
     Synchronous rgb function, starts the runloop if it isn't running                                                           
 
                                                                                                                                
 
                                                                                                                                
Line 23: Line 23:
 
         Nonzero on error.                                                                                                     
 
         Nonzero on error.                                                                                                     
  
int freenect_get_depth(char **depth, uint32_t *timestamp);
+
    int freenect_get_depth(char **depth, uint32_t *timestamp);
 
     Synchronous depth function, starts the runloop if it isn't running                                                         
 
     Synchronous depth function, starts the runloop if it isn't running                                                         
 
                                                                                                                                
 
                                                                                                                                

Revision as of 19:12, 24 November 2010

About

The freenect driver provides an "asynchronous" interface where you provide callbacks and it calls them when sensor data is available. There is another way of thinking about the data by having a "synchronous" interface where you call a function to get an image "freenect_get_depth" or "freenect_get_rgb" and it blocks and gives you back the data.

This is implemented by using a thread to handle the callbacks and a buffer to provide an interface for the client. You are guaranteed to get the buffers in order by timestamp (e.g., you won't get something older than your last). You may not get all frames with this interface (e.g., there may be gaps).

Who is involved

Search for Synchronous in People

However (Brandyn) and (amiller) are trying to organize things for the Synchronous interface.

Interface

  1. define DEPTH_BYTES 614400 // 480 * 640 * 2
  2. define RGB_BYTES 921600 // 480 * 640 * 3
   int freenect_get_rgb(char **rgb, uint32_t *timestamp);
   Synchronous rgb function, starts the runloop if it isn't running                                                          
                                                                                                                             
   Args:                                                                                                                     
       rgb: Populated with a pointer to a RGB buffer (of size RGB_BYTES)                                                     
       timestamp: Populated with a pointer to the associated timestamp                                                       
                                                                                                                             
   Returns:                                                                                                                  
       Nonzero on error.                                                                                                     
   int freenect_get_depth(char **depth, uint32_t *timestamp);
   Synchronous depth function, starts the runloop if it isn't running                                                        
                                                                                                                             
   Args:                                                                                                                     
       depth: Populated with a pointer to a depth buffer (of size DEPTH_BYTES)                                               
       timestamp: Populated with a pointer to the associated timestamp                                                       
                                                                                                                             
   Returns:                                                                                                                  
       Nonzero on error.