Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Attributes | List of all members
BIAS::VideoSource_Kinect_Callback Class Reference

Implementing FreenectDevice Interface, this class is used internally by VideoSource_Kinect - do not use directly. More...

#include <VideoSource/VideoSource_Kinect.hh>

+ Inheritance diagram for BIAS::VideoSource_Kinect_Callback:
+ Collaboration diagram for BIAS::VideoSource_Kinect_Callback:

Public Member Functions

void CreateLookupTable (double px, double py, double fx, double fy)
 
virtual void DepthCallback (void *depth, uint32_t timestamp)
 libfreenect thread calls this when new depth data is available More...
 
virtual int GetLatestColor (Camera< unsigned char > &image)
 Callbacks store image data in double buffer, get latest. More...
 
virtual int GetLatestDepth (Camera< float > &image)
 Callbacks store image data in double buffer, get latest Note that the depth image is shifted by 3 pixels in order to fit the IR image. More...
 
virtual void SetDepthMode (int mode)
 
virtual int SetSwitchVideoModeAfterGrab (bool switchMode)
 
virtual int SetVideoMode (freenect_video_format format)
 
virtual void VideoCallback (void *video, uint32_t timestamp)
 libfreenect thread calls this when new color data is available More...
 
 VideoSource_Kinect_Callback (freenect_context *_ctx, int _index)
 libfreenect constructor used by VideoSource_Kinect, do not use directly More...
 

Protected Attributes

int capMode_
 
pthread_mutex_t * color_mutex
 
pthread_mutex_t * coloravail_mutex
 
std::vector< Camera< unsigned
char > > 
colorbuffer_
 
pthread_mutex_t * depth_mutex
 
pthread_mutex_t * depthavail_mutex
 
std::vector< Camera< float > > depthbuffer_
 
Image< float > depthLookupTable_
 
freenect_video_format format_
 
float lookup_ [2048]
 
pthread_cond_t * newColorAvail_
 
pthread_cond_t * newDepthAvail_
 
bool switch_
 
int writingToC_
 
int writingToD_
 

Detailed Description

Implementing FreenectDevice Interface, this class is used internally by VideoSource_Kinect - do not use directly.

Author
fkellner 02/11

Definition at line 154 of file VideoSource_Kinect.hh.

Constructor & Destructor Documentation

BIAS::VideoSource_Kinect_Callback::VideoSource_Kinect_Callback ( freenect_context *  _ctx,
int  _index 
)

libfreenect constructor used by VideoSource_Kinect, do not use directly

Parameters
_ctxlibfreenect context, i.e. opened usb bus
_indexindex of camera on context/bus
Author
fkellner 02/11

Definition at line 274 of file VideoSource_Kinect.cpp.

References capMode_, BIAS::ImageBase::CM_Bayer_GRBG, color_mutex, coloravail_mutex, colorbuffer_, depth_mutex, depthavail_mutex, depthbuffer_, BIAS::VideoSource_Kinect_Base::DepthRay, lookup_, newColorAvail_, newDepthAvail_, switch_, writingToC_, and writingToD_.

Member Function Documentation

void BIAS::VideoSource_Kinect_Callback::CreateLookupTable ( double  px,
double  py,
double  fx,
double  fy 
)
void BIAS::VideoSource_Kinect_Callback::DepthCallback ( void *  depth,
uint32_t  timestamp 
)
virtual

libfreenect thread calls this when new depth data is available

Parameters
videopointer to depth bytes (2 per pixel)
timestampframe timestamp, todo: interpret, put as metadata
Author
fkellner 02/11

Definition at line 325 of file VideoSource_Kinect.cpp.

References capMode_, depth_mutex, depthbuffer_, BIAS::VideoSource_Kinect_Base::DepthEuclidean, depthLookupTable_, BIAS::VideoSource_Kinect_Base::DepthRaw, BIAS::VideoSource_Kinect_Base::DepthRay, BIAS::Image< StorageType >::GetImageData(), lookup_, newDepthAvail_, and writingToD_.

int BIAS::VideoSource_Kinect_Callback::GetLatestColor ( Camera< unsigned char > &  image)
virtual

Callbacks store image data in double buffer, get latest.

Parameters
imagecolor image
Author
fkellner 02/11

Definition at line 369 of file VideoSource_Kinect.cpp.

References color_mutex, coloravail_mutex, colorbuffer_, BIAS::ImageBase::CopyIn_NoInit(), format_, newColorAvail_, SetVideoMode(), switch_, and writingToC_.

int BIAS::VideoSource_Kinect_Callback::GetLatestDepth ( Camera< float > &  image)
virtual

Callbacks store image data in double buffer, get latest Note that the depth image is shifted by 3 pixels in order to fit the IR image.

Parameters
imagedepth image
Author
fkellner 02/11

Definition at line 388 of file VideoSource_Kinect.cpp.

References depth_mutex, depthavail_mutex, depthbuffer_, BIAS::Image< StorageType >::GetImageData(), newDepthAvail_, and writingToD_.

void BIAS::VideoSource_Kinect_Callback::SetDepthMode ( int  mode)
virtual

Definition at line 433 of file VideoSource_Kinect.cpp.

References capMode_.

int BIAS::VideoSource_Kinect_Callback::SetSwitchVideoModeAfterGrab ( bool  switchMode)
virtual

Definition at line 426 of file VideoSource_Kinect.cpp.

References switch_.

int BIAS::VideoSource_Kinect_Callback::SetVideoMode ( freenect_video_format  format)
virtual

Definition at line 406 of file VideoSource_Kinect.cpp.

References format_.

Referenced by GetLatestColor().

void BIAS::VideoSource_Kinect_Callback::VideoCallback ( void *  video,
uint32_t  timestamp 
)
virtual

libfreenect thread calls this when new color data is available

Parameters
videopointer to color bytes (3 per pixel), todo: convince libfreenect to deliver raw rggb data
timestampframe timestamp, todo: interpret, put as metadata
Author
fkellner 02/11

Definition at line 312 of file VideoSource_Kinect.cpp.

References color_mutex, colorbuffer_, newColorAvail_, and writingToC_.

Member Data Documentation

int BIAS::VideoSource_Kinect_Callback::capMode_
protected

Definition at line 229 of file VideoSource_Kinect.hh.

Referenced by DepthCallback(), SetDepthMode(), and VideoSource_Kinect_Callback().

pthread_mutex_t* BIAS::VideoSource_Kinect_Callback::color_mutex
protected
pthread_mutex_t* BIAS::VideoSource_Kinect_Callback::coloravail_mutex
protected

Definition at line 215 of file VideoSource_Kinect.hh.

Referenced by GetLatestColor(), and VideoSource_Kinect_Callback().

std::vector< Camera<unsigned char> > BIAS::VideoSource_Kinect_Callback::colorbuffer_
protected
pthread_mutex_t* BIAS::VideoSource_Kinect_Callback::depth_mutex
protected
pthread_mutex_t* BIAS::VideoSource_Kinect_Callback::depthavail_mutex
protected

Definition at line 216 of file VideoSource_Kinect.hh.

Referenced by GetLatestDepth(), and VideoSource_Kinect_Callback().

std::vector< Camera<float> > BIAS::VideoSource_Kinect_Callback::depthbuffer_
protected
Image<float> BIAS::VideoSource_Kinect_Callback::depthLookupTable_
protected

Definition at line 223 of file VideoSource_Kinect.hh.

Referenced by CreateLookupTable(), and DepthCallback().

freenect_video_format BIAS::VideoSource_Kinect_Callback::format_
protected

Definition at line 226 of file VideoSource_Kinect.hh.

Referenced by GetLatestColor(), and SetVideoMode().

float BIAS::VideoSource_Kinect_Callback::lookup_[2048]
protected

Definition at line 220 of file VideoSource_Kinect.hh.

Referenced by DepthCallback(), and VideoSource_Kinect_Callback().

pthread_cond_t* BIAS::VideoSource_Kinect_Callback::newColorAvail_
protected
pthread_cond_t* BIAS::VideoSource_Kinect_Callback::newDepthAvail_
protected
bool BIAS::VideoSource_Kinect_Callback::switch_
protected
int BIAS::VideoSource_Kinect_Callback::writingToC_
protected
int BIAS::VideoSource_Kinect_Callback::writingToD_
protected

The documentation for this class was generated from the following files: