Fawkes API  Fawkes Development Version
firevision::KinectCamera Class Reference

Access the Microsoft Kinect camera using the freenect driver. More...

#include <>>

Inheritance diagram for firevision::KinectCamera:

Public Member Functions

 KinectCamera (const CameraArgumentParser *cap=NULL)
 Constructor. More...
 
 ~KinectCamera ()
 Destructor. More...
 
virtual void open ()
 Open the camera. More...
 
virtual void start ()
 Start image transfer from the camera. More...
 
virtual void stop ()
 Stop image transfer from the camera. More...
 
virtual void close ()
 Close camera. More...
 
virtual void capture ()
 Capture an image. More...
 
virtual void flush ()
 Flush image queue. More...
 
virtual bool ready ()
 Camera is ready for taking pictures. More...
 
virtual void print_info ()
 Print out camera information. More...
 
virtual unsigned char * buffer ()
 Get access to current image buffer. More...
 
virtual unsigned int buffer_size ()
 Size of buffer. More...
 
virtual void dispose_buffer ()
 Dispose current buffer. More...
 
virtual unsigned int pixel_width ()
 Width of image in pixels. More...
 
virtual unsigned int pixel_height ()
 Height of image in pixels. More...
 
virtual colorspace_t colorspace ()
 Colorspace of returned image. More...
 
virtual void set_image_number (unsigned int n)
 Set image number to retrieve. More...
 
- Public Member Functions inherited from firevision::Camera
virtual ~Camera ()
 Virtual empty destructor. More...
 
virtual fawkes::Timecapture_time ()
 Get the Time of the last successfully captured image. More...
 

Static Public Attributes

static const unsigned int RGB_IMAGE = 0
 Color image. More...
 
static const unsigned int FALSE_COLOR_DEPTH_IMAGE = 1
 False color depth image. More...
 

Detailed Description

Access the Microsoft Kinect camera using the freenect driver.

Author
Daniel Beck

Definition at line 58 of file kinect.h.

Constructor & Destructor Documentation

◆ KinectCamera()

firevision::KinectCamera::KinectCamera ( const CameraArgumentParser cap = NULL)

Constructor.

Parameters
capcamera argument parser

Definition at line 118 of file kinect.cpp.

◆ ~KinectCamera()

firevision::KinectCamera::~KinectCamera ( )

Destructor.

Definition at line 138 of file kinect.cpp.

Member Function Documentation

◆ buffer()

unsigned char * firevision::KinectCamera::buffer ( )
virtual

Get access to current image buffer.

This will return a pointer to the current buffer. The buffer contains an image of the given colorspace, width and height.

Returns
pointer to image buffer

Implements firevision::Camera.

Definition at line 279 of file kinect.cpp.

◆ buffer_size()

unsigned int firevision::KinectCamera::buffer_size ( )
virtual

Size of buffer.

Gets the size in bytes of the buffer returned by buffer().

Returns
size of buffer in bytes

Implements firevision::Camera.

Definition at line 285 of file kinect.cpp.

◆ capture()

void firevision::KinectCamera::capture ( )
virtual

Capture an image.

Although cameras shall operate with a continuous image flow where possible sometimes capturing an image means copying a buffer or advancing a buffer list pointer. This shall be done in this method. For a camera-using application it is mandatory to call capture() just before accessing the image buffer.

Implements firevision::Camera.

Definition at line 204 of file kinect.cpp.

References firevision::FvFreenectDevice::depth_buffer(), and FALSE_COLOR_DEPTH_IMAGE.

◆ close()

void firevision::KinectCamera::close ( )
virtual

Close camera.

This closes the camera device. The camera must have been stopped before calling close().

Implements firevision::Camera.

Definition at line 197 of file kinect.cpp.

◆ colorspace()

colorspace_t firevision::KinectCamera::colorspace ( )
virtual

Colorspace of returned image.

Returns
colorspace of image returned by buffer()

Implements firevision::Camera.

Definition at line 308 of file kinect.cpp.

◆ dispose_buffer()

void firevision::KinectCamera::dispose_buffer ( )
virtual

Dispose current buffer.

Some cameras need disposal of the current buffer (for example to free space in a queue to retrieve the next image). This is done with this method. It has to be called after all work has been done on the image as desired. After dispose_buffer() has been called no further access may happen to the image buffer or undesired behavior may happen.

Implements firevision::Camera.

Definition at line 291 of file kinect.cpp.

◆ flush()

void firevision::KinectCamera::flush ( )
virtual

Flush image queue.

Some cameras may have an image buffer queue. With this it can happen that if the processing of an image took longer than desired it is needed to flush this buffer queue.

Implements firevision::Camera.

Definition at line 263 of file kinect.cpp.

◆ open()

void firevision::KinectCamera::open ( )
virtual

Open the camera.

The camera is opened, but image transfer not yet started. This can be used to detect general problems with the camera while delaying the real transfer startup until it is needed.

Implements firevision::Camera.

Definition at line 144 of file kinect.cpp.

References set_image_number().

◆ pixel_height()

unsigned int firevision::KinectCamera::pixel_height ( )
virtual

Height of image in pixels.

Returns
height of image in pixels

Implements firevision::Camera.

Definition at line 302 of file kinect.cpp.

◆ pixel_width()

unsigned int firevision::KinectCamera::pixel_width ( )
virtual

Width of image in pixels.

Returns
width of image in pixels

Implements firevision::Camera.

Definition at line 296 of file kinect.cpp.

◆ print_info()

void firevision::KinectCamera::print_info ( )
virtual

Print out camera information.

Shall print out camera information and current setup information on stdout.

Implements firevision::Camera.

Definition at line 274 of file kinect.cpp.

◆ ready()

bool firevision::KinectCamera::ready ( )
virtual

Camera is ready for taking pictures.

The camera has been opened and started correctly and may now provide images.

Returns
true, if the camera is ready, false otherwise

Implements firevision::Camera.

Definition at line 268 of file kinect.cpp.

◆ set_image_number()

void firevision::KinectCamera::set_image_number ( unsigned int  n)
virtual

Set image number to retrieve.

If a camera is able to retrieve several images this method can be used to select the image to be retrieved with the next call to capture().

Parameters
nimage number to set

Implements firevision::Camera.

Definition at line 314 of file kinect.cpp.

References FALSE_COLOR_DEPTH_IMAGE, firevision::FvFreenectDevice::rgb_buffer(), and RGB_IMAGE.

Referenced by open().

◆ start()

void firevision::KinectCamera::start ( )
virtual

Start image transfer from the camera.

For many cameras opening the camera and starting transmission of images are two tasks. This method will simply initiate the transfer after the camera as been opened. And exception shall be thrown if the camera has not been opened.

Implements firevision::Camera.

Definition at line 161 of file kinect.cpp.

◆ stop()

void firevision::KinectCamera::stop ( )
virtual

Stop image transfer from the camera.

This will stop the image transfer initiated with start(). This can be used to start and stop the image transfer at will without opening and closing operations inbetween.

Implements firevision::Camera.

Definition at line 179 of file kinect.cpp.

Member Data Documentation

◆ FALSE_COLOR_DEPTH_IMAGE

const unsigned int firevision::KinectCamera::FALSE_COLOR_DEPTH_IMAGE = 1
static

False color depth image.

Definition at line 87 of file kinect.h.

Referenced by capture(), and set_image_number().

◆ RGB_IMAGE

const unsigned int firevision::KinectCamera::RGB_IMAGE = 0
static

Color image.

Definition at line 86 of file kinect.h.

Referenced by set_image_number().


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