Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Attributes
icl::io::GenericGrabber Class Reference

Common interface class for all grabbers. More...

#include <GenericGrabber.h>

Inheritance diagram for icl::io::GenericGrabber:
icl::utils::Uncopyable icl::utils::ConfigurableProxy

List of all members.

Public Member Functions

 GenericGrabber (const utils::ProgArg &pa) throw (utils::ICLException)
 << internal protection for re-initialization
 GenericGrabber (const std::string &devicePriorityList, const std::string &params, bool notifyErrors=true) throw (utils::ICLException)
 Create a generic grabber instance with given device priority list.
 GenericGrabber ()
 Empty default constructor, which creates a null-instance.
void init (const std::string &devicePriorityList, const std::string &params, bool notifyErrors=true) throw (utils::ICLException)
 initialization function to change/initialize the grabber back-end
void init (const utils::ProgArg &pa) throw (utils::ICLException)
 this method works just like the other init method
std::string getType () const
 return the actual grabber type
GrabbergetGrabber () const
 returns the wrapped grabber itself
virtual ~GenericGrabber ()
 Destructor.
const core::ImgBasegrab (core::ImgBase **dst=0)
 grab function calls the Grabber-specific acquireImage-method and applies distortion if necessary
bool isNull () const
 returns wheter an underlying grabber could be created
 operator bool () const
 simpler interface for isNull() (returns !isNull()
void setDesiredFormatInternal (core::format fmt)
 internally set a desired format
void setDesiredSizeInternal (const utils::Size &size)
 internally set a desired format
void setDesiredDepthInternal (core::depth d)
 internally set a desired format
core::format getDesiredFormatInternal () const
 returns the desired format
core::depth getDesiredDepthInternal () const
 returns the desired format
utils::Size getDesiredSizeInternal () const
 returns the desired format
void registerCallback (Grabber::callback cb)
 passes registered callback to the internal pointer
void removeAllCallbacks ()
 passes registered callback to the internal pointer
template<class T >
bool desiredUsed () const
 returns whether the desired parameter for the given type is used
template<class T >
void useDesired (const T &t)
 sets desired parameters (only available for core::depth,utils::Size and core::format)
void useDesired (core::depth d, const utils::Size &size, core::format fmt)
 sets up the grabber to use all given desired parameters
template<class T >
void ignoreDesired ()
 set the grabber to ignore the desired param of type T
void ignoreDesired ()
 sets up the grabber to ignore all desired parameters
template<class T >
getDesired () const
 returns the desired value for the given type T
void enableUndistortion (const std::string &filename)
 enables the undistorion
void enableUndistortion (const ImageUndistortion &udist)
 enables the undistortion plugin for the grabber using radial and tangential distortion parameters
void enableUndistortion (const utils::ProgArg &pa)
 enables undistortion from given programm argument.
void enableUndistortion (const core::Img32f &warpMap)
 enables undistortion for given warp map
void setUndistortionInterpolationMode (core::scalemode mode)
 sets how undistortion is interpolated (supported modes are interpolateNN and interpolateLIN)
void disableUndistortion ()
 disables distortion
bool isUndistortionEnabled () const
 returns whether distortion is currently enabled
const core::Img32fgetUndistortionWarpMap () const
 returns the internal warp map or NULL if undistortion is not enabled
void init (const GrabberDeviceDescription &dev)
 initializes the grabber from given FoundDevice instance

Static Public Member Functions

static void resetBus (const std::string &deviceList="dc", bool verbose=false)
 resets resource on given devices (e.g. firewire bus)
static const std::vector
< GrabberDeviceDescription > & 
getDeviceList (const std::string &filter, bool rescan=true)
 returns a list of all currently available devices (according to the filter-string)

Private Attributes

Grabberm_poGrabber
 internally wrapped grabber instance
GrabberDeviceDescription m_poDesc
 description of current Grabber
utils::Mutex m_mutex

Detailed Description

Common interface class for all grabbers.

The generic grabber provides an interface for a multi-platform compatible grabber. Image processing applications should use this Grabber class. The GenericGrabber also provides camera configuration via ConfigurableProxy interface.


Constructor & Destructor Documentation

<< internal protection for re-initialization

Initialized the grabber from given prog-arg The progarg needs two sub-parameters

icl::io::GenericGrabber::GenericGrabber ( const std::string &  devicePriorityList,
const std::string &  params,
bool  notifyErrors = true 
) throw (utils::ICLException) [inline]

Create a generic grabber instance with given device priority list.

internally this function calls the init function immediately

Empty default constructor, which creates a null-instance.

null instances of grabbers can be adapted using the init-function

Destructor.


Member Function Documentation

template<class T >
bool icl::io::GenericGrabber::desiredUsed ( ) const [inline]

returns whether the desired parameter for the given type is used

This method is only available for the type core::depth,icl::utils::Size and core::format

disables distortion

void icl::io::GenericGrabber::enableUndistortion ( const std::string &  filename) [inline]

enables the undistorion

enables the undistortion plugin for the grabber using radial and tangential distortion parameters

enables undistortion from given programm argument.

where first argument is the filename of the xml file and second is the size of picture

void icl::io::GenericGrabber::enableUndistortion ( const core::Img32f warpMap) [inline]

enables undistortion for given warp map

template<class T >
T icl::io::GenericGrabber::getDesired ( ) const [inline]

returns the desired value for the given type T

This method is only available for core::depth,utils::Size and core::format

returns the desired format

returns the desired format

returns the desired format

static const std::vector<GrabberDeviceDescription>& icl::io::GenericGrabber::getDeviceList ( const std::string &  filter,
bool  rescan = true 
) [static]

returns a list of all currently available devices (according to the filter-string)

The filter-string is a comma separated list of single filters like

 dc=0,unicap 

If a single token has the core::format deviceType=deviceID, then only not only the device type but also a specific ID is used for the filtering operation. If, otherwise, a token has the core::format deviceType, then all possible devices for this device type are listed.

returns the wrapped grabber itself

std::string icl::io::GenericGrabber::getType ( ) const [inline]

return the actual grabber type

returns the internal warp map or NULL if undistortion is not enabled

grab function calls the Grabber-specific acquireImage-method and applies distortion if necessary

If dst is not NULL, it is exploited and filled with image data

template<class T >
void icl::io::GenericGrabber::ignoreDesired ( ) [inline]

set the grabber to ignore the desired param of type T

This method is only available for core::depth,utils::Size and core::format

sets up the grabber to ignore all desired parameters

void icl::io::GenericGrabber::init ( const std::string &  devicePriorityList,
const std::string &  params,
bool  notifyErrors = true 
) throw (utils::ICLException)

initialization function to change/initialize the grabber back-end

Parameters:
devicePriorityListComma separated list of device tokens (no white spaces). something like "dc,pwc,file,unicap" with arbitrary order undesired devices can be left out. In particular you can also give only a single desired device type e.g. "pwc". The following device types are supported:
  • v4l Video for Linux 2 based grabber
  • dc dc grabber
  • dc800 dc grabber but with 800MBit iso-speed
  • file file grabber
  • demo demo grabber (moving red spot)
  • create create grabber (create an image using ICL's create function)
  • sr SwissRanger camera (mesa-imaging)
  • video Xine based video grabber (grabbing videos frame by frame)
  • cvcam OpenCV based camera grabber (supporting video 4 linux devices)
  • cvvideo OpenCV based video grabber
  • sm Qt-based Shared-Memory grabber (using QSharedMemoryInstance)
  • myr Uses Myrmex tactile input device as image source
  • kinectd Uses libfreenect to grab Microsoft-Kinect's core::depth images
  • kinectc Uses libfreenect to grab Microsoft-Kinect's rgb color images
  • kinecti Uses libfreenect to grab Microsoft-Kinect's IR images
  • rsb Robotics Service Bus Source
paramscomma separated device depend parameter list: e.g. "v4l=0,file=images//image*.ppm,dc=0" with self-explaining syntax
Additionally, each token a=b can be extended by device property that are directly set after device instantiation. E.g. demo=0@size=QVGA@blob-red=128, instantiates a demo-grabber, where the two additionally given properties (size and blob-red) are set immediately after grabber instantiation. By these means particularly a grabber's core::format can be set in the grabber instantiation call. Furthermore, three special @-tokens are possible: @info (e.g. dc=0@info) lists the 0th dc device's available properties. @load=filename loads a given property filename directly. @udist=filename loads a given undistortion parameter filename directly and therefore makes the grabber grab undistorted images according to the undistortion parameters and model type (either 3 or 5 parameters) that is found in the given xml-file. todo fix this sentence according to the fixed application names Please note, that valid xml-undistortion files can be created using the undistortion-calibration tools icl-opencvcamcalib-demo, icl-intrinsic-camera-calibration and icl-intrinsic-calibrator-demo. On the C++-level, this is only a minor advantage, since all these things can also be achieved via function calls, however if you use the most recommended way for ICL-Grabber instantiation using ICL's program-argument evaluation framework, The GenericGrabber is instantiated using grabber.init(pa("-i")) which then allows the application user to set grabber parameters via addiation @-options on the command line: e.g.: "icl-camviewer -input dc 0\@size=VGA"

Semantics:

  • v4l=device-name (e.g. "/dev/video0")
  • dc=device-index (int) or dc=UniqueID (string) (the unique ID can be found with 'icl-cam-cfg d -list-devices-only')
  • dc800=device-index (int)
  • file=pattern (string)
  • demo=anything (not regarded)
  • create=image name (see also icl::TestImages::create)
  • mv=device-name (string)
  • sr=device-serial-number (-1 -> menu, 0 -> auto-select) or sr=NcC where N is the device numer as above, c is the character 'c' and C is the channel index to pick (0: core::depth-map, 1: confidence map, 2: intensity image
  • video=video-filename (string)
  • cvcam=camera index (0=first device,1=2nd device, ...) here, you can also use opencv's so called 'domain offsets': current values are:
    • 100 MIL-drivers (proprietary)
    • 200 V4L,V4L2 and VFW,
    • 300 Firewire,
    • 400 TXYZ (proprietary)
    • 500 QuickTime
    • 600 Unicap
    • 700 Direct Show Video Input (e.g. device ID 301 selects the 2nd firewire device)
  • cvvideo=video-filename (string)
  • sm=Shared-memory-segment-id (string)
  • myr=deviceIndex (int) (the device index is used to create the /dev/videoX device)
  • kinectd=device-index (int)
  • kinectc=device-index (int)
  • kinecti=device-index (int)
  • rsb=[comma-sep. transport-list=spread]:scope)
Parameters:
notifyErrorsif set to false, no exception is thrown if no suitable device was found

this method works just like the other init method

initializes the grabber from given FoundDevice instance

calls 'init(dev.type,dev.type+"="+dev.id,false)'

bool icl::io::GenericGrabber::isNull ( ) const [inline]

returns wheter an underlying grabber could be created

returns whether distortion is currently enabled

icl::io::GenericGrabber::operator bool ( ) const [inline]

simpler interface for isNull() (returns !isNull()

passes registered callback to the internal pointer

passes registered callback to the internal pointer

static void icl::io::GenericGrabber::resetBus ( const std::string &  deviceList = "dc",
bool  verbose = false 
) [static]

resets resource on given devices (e.g. firewire bus)

internally set a desired format

internally set a desired format

internally set a desired format

sets how undistortion is interpolated (supported modes are interpolateNN and interpolateLIN)

Please note, that this method has no effect if the undistortion was not enabled before using one of the Grabber::enableUndistortion methods. Furthermore, the setting is lost if the undistortion is deactivated using Grabber::disableUndistortion

template<class T >
void icl::io::GenericGrabber::useDesired ( const T &  t) [inline]

sets desired parameters (only available for core::depth,utils::Size and core::format)

void icl::io::GenericGrabber::useDesired ( core::depth  d,
const utils::Size size,
core::format  fmt 
) [inline]

sets up the grabber to use all given desired parameters


Member Data Documentation

description of current Grabber

internally wrapped grabber instance


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines