Image Component Library (ICL)
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
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

Public Member Functions

 GenericGrabber (const utils::ProgArg &pa)
 Initialized the grabber from given prog-arg. More...
 
 GenericGrabber (const std::string &devicePriorityList, const std::string &params, bool notifyErrors=true)
 Create a generic grabber instance with given device priority list. More...
 
 GenericGrabber ()
 Empty default constructor, which creates a null-instance. More...
 
void init (const std::string &devicePriorityList, const std::string &params, bool notifyErrors=true)
 initialization function to change/initialize the grabber back-end More...
 
void init (const utils::ProgArg &pa)
 this method works just like the other init method More...
 
std::string getType () const
 return the actual grabber type More...
 
GrabbergetGrabber () const
 returns the wrapped grabber itself More...
 
virtual ~GenericGrabber ()
 Destructor. More...
 
const core::ImgBasegrab (core::ImgBase **dst=0)
 grab function calls the Grabber-specific acquireImage-method and applies distortion if necessary More...
 
bool isNull () const
 returns wheter an underlying grabber could be created More...
 
 operator bool () const
 simpler interface for isNull() (returns !isNull() More...
 
void setDesiredFormatInternal (core::format fmt)
 internally set a desired format More...
 
void setDesiredSizeInternal (const utils::Size &size)
 internally set a desired format More...
 
void setDesiredDepthInternal (core::depth d)
 internally set a desired format More...
 
core::format getDesiredFormatInternal () const
 returns the desired format More...
 
core::depth getDesiredDepthInternal () const
 returns the desired format More...
 
utils::Size getDesiredSizeInternal () const
 returns the desired format More...
 
void registerCallback (Grabber::callback cb)
 passes registered callback to the internal pointer More...
 
void removeAllCallbacks ()
 passes registered callback to the internal pointer More...
 
template<class T >
bool desiredUsed () const
 returns whether the desired parameter for the given type is used More...
 
template<class T >
void useDesired (const T &t)
 sets desired parameters (only available for core::depth,utils::Size and core::format) More...
 
void useDesired (core::depth d, const utils::Size &size, core::format fmt)
 sets up the grabber to use all given desired parameters More...
 
template<class T >
void ignoreDesired ()
 set the grabber to ignore the desired param of type T More...
 
void ignoreDesired ()
 sets up the grabber to ignore all desired parameters More...
 
template<class T >
getDesired () const
 returns the desired value for the given type T More...
 
void enableUndistortion (const std::string &filename)
 enables the undistorion More...
 
void enableUndistortion (const ImageUndistortion &udist)
 enables the undistortion plugin for the grabber using radial and tangential distortion parameters More...
 
void enableUndistortion (const utils::ProgArg &pa)
 enables undistortion from given programm argument. More...
 
void enableUndistortion (const core::Img32f &warpMap)
 enables undistortion for given warp map More...
 
void setUndistortionInterpolationMode (core::scalemode mode)
 sets how undistortion is interpolated (supported modes are interpolateNN and interpolateLIN) More...
 
void disableUndistortion ()
 disables distortion More...
 
bool isUndistortionEnabled () const
 returns whether distortion is currently enabled More...
 
const core::Img32fgetUndistortionWarpMap () const
 returns the internal warp map or NULL if undistortion is not enabled More...
 
void init (const GrabberDeviceDescription &dev)
 initializes the grabber from given FoundDevice instance More...
 
- Public Member Functions inherited from icl::utils::ConfigurableProxy
virtual ~ConfigurableProxy ()
 virtual destructor More...
 
 ConfigurableProxy (Configurable *c=NULL)
 Constructor with passed internal Configurable. More...
 
void setInternalConfigurable (Configurable *c=NULL)
 sets the internally used Configurable to the passed one More...
 
ConfigurablegetInternalConfigurable () const
 returns the internally used Configurable More...
 
void setPropertyValue (const std::string &propertyName, const Any &value)
 sets a property value More...
 
std::vector< std::string > getPropertyList () const
 returns a list of All properties, that can be set using setProperty More...
 
bool supportsProperty (const std::string &propertyName) const
 base implementation for property check (seaches in the property list) More...
 
void saveProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=Configurable::EMPTY_VEC) const
 writes all available properties into a file More...
 
void loadProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=Configurable::EMPTY_VEC)
 reads a camera config file from disc More...
 
void addChildConfigurable (Configurable *configurable, const std::string &childPrefix="")
 
void registerCallback (Configurable::Callback cb)
 
std::string getPropertyType (const std::string &propertyName) const
 get type of property More...
 
std::string getPropertyInfo (const std::string &propertyName) const
 get information of a properties valid values More...
 
Any getPropertyValue (const std::string &propertyName) const
 returns the current value of a property or a parameter More...
 
std::string getPropertyToolTip (const std::string &propertyName) const
 returns the tooltip description for a given property More...
 
int getPropertyVolatileness (const std::string &propertyName) const
 Returns whether this property may be changed internally. More...
 
void syncChangesTo (Configurable *configurables, int num=1)
 syncronzies all property changes to the given configurable More...
 
void syncChangesTo (ConfigurableProxy *configurable)
 syncronzies all property changes to the given configurable More...
 

Static Public Member Functions

static void resetBus (const std::string &deviceList="dc", bool verbose=false)
 resets resource on given devices (e.g. firewire bus) More...
 
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) More...
 

Private Attributes

Grabberm_poGrabber
 internally wrapped grabber instance More...
 
GrabberDeviceDescription m_poDesc
 description of current Grabber More...
 
utils::Mutex m_mutex
 
ConfigurableRemoteServerm_remoteServer
 << internal protection for re-initialization More...
 

Additional Inherited Members

- Protected Member Functions inherited from icl::utils::Uncopyable
 Uncopyable ()
 Empty base constructor. More...
 

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

◆ GenericGrabber() [1/3]

icl::io::GenericGrabber::GenericGrabber ( const utils::ProgArg pa)
inline

Initialized the grabber from given prog-arg.

The progarg needs two sub-parameters

◆ GenericGrabber() [2/3]

icl::io::GenericGrabber::GenericGrabber ( const std::string &  devicePriorityList,
const std::string &  params,
bool  notifyErrors = true 
)
inline

Create a generic grabber instance with given device priority list.

internally this function calls the init function immediately

◆ GenericGrabber() [3/3]

icl::io::GenericGrabber::GenericGrabber ( )
inline

Empty default constructor, which creates a null-instance.

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

◆ ~GenericGrabber()

virtual icl::io::GenericGrabber::~GenericGrabber ( )
virtual

Destructor.

Member Function Documentation

◆ desiredUsed()

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

◆ disableUndistortion()

void icl::io::GenericGrabber::disableUndistortion ( )
inline

disables distortion

◆ enableUndistortion() [1/4]

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

enables the undistorion

◆ enableUndistortion() [2/4]

void icl::io::GenericGrabber::enableUndistortion ( const ImageUndistortion udist)
inline

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

◆ enableUndistortion() [3/4]

void icl::io::GenericGrabber::enableUndistortion ( const utils::ProgArg pa)
inline

enables undistortion from given programm argument.

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

◆ enableUndistortion() [4/4]

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

enables undistortion for given warp map

◆ getDesired()

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

◆ getDesiredDepthInternal()

core::depth icl::io::GenericGrabber::getDesiredDepthInternal ( ) const
inline

returns the desired format

◆ getDesiredFormatInternal()

core::format icl::io::GenericGrabber::getDesiredFormatInternal ( ) const
inline

returns the desired format

◆ getDesiredSizeInternal()

utils::Size icl::io::GenericGrabber::getDesiredSizeInternal ( ) const
inline

returns the desired format

◆ getDeviceList()

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.

◆ getGrabber()

Grabber* icl::io::GenericGrabber::getGrabber ( ) const
inline

returns the wrapped grabber itself

◆ getType()

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

return the actual grabber type

◆ getUndistortionWarpMap()

const core::Img32f* icl::io::GenericGrabber::getUndistortionWarpMap ( ) const
inline

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

◆ grab()

const core::ImgBase* icl::io::GenericGrabber::grab ( core::ImgBase **  dst = 0)
inline

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

◆ ignoreDesired() [1/2]

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

◆ ignoreDesired() [2/2]

void icl::io::GenericGrabber::ignoreDesired ( )
inline

sets up the grabber to ignore all desired parameters

◆ init() [1/3]

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

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
  • optris For Optris' IR-Cameras
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)
  • optris=camera-serial
Parameters
notifyErrorsif set to false, no exception is thrown if no suitable device was found

◆ init() [2/3]

void icl::io::GenericGrabber::init ( const utils::ProgArg pa)

this method works just like the other init method

◆ init() [3/3]

void icl::io::GenericGrabber::init ( const GrabberDeviceDescription dev)
inline

initializes the grabber from given FoundDevice instance

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

◆ isNull()

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

returns wheter an underlying grabber could be created

◆ isUndistortionEnabled()

bool icl::io::GenericGrabber::isUndistortionEnabled ( ) const
inline

returns whether distortion is currently enabled

◆ operator bool()

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

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

◆ registerCallback()

void icl::io::GenericGrabber::registerCallback ( Grabber::callback  cb)
inline

passes registered callback to the internal pointer

◆ removeAllCallbacks()

void icl::io::GenericGrabber::removeAllCallbacks ( )
inline

passes registered callback to the internal pointer

◆ resetBus()

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

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

◆ setDesiredDepthInternal()

void icl::io::GenericGrabber::setDesiredDepthInternal ( core::depth  d)
inline

internally set a desired format

◆ setDesiredFormatInternal()

void icl::io::GenericGrabber::setDesiredFormatInternal ( core::format  fmt)
inline

internally set a desired format

◆ setDesiredSizeInternal()

void icl::io::GenericGrabber::setDesiredSizeInternal ( const utils::Size size)
inline

internally set a desired format

◆ setUndistortionInterpolationMode()

void icl::io::GenericGrabber::setUndistortionInterpolationMode ( core::scalemode  mode)
inline

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

◆ useDesired() [1/2]

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)

◆ useDesired() [2/2]

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

◆ m_mutex

utils::Mutex icl::io::GenericGrabber::m_mutex
mutableprivate

◆ m_poDesc

GrabberDeviceDescription icl::io::GenericGrabber::m_poDesc
private

description of current Grabber

◆ m_poGrabber

Grabber* icl::io::GenericGrabber::m_poGrabber
private

internally wrapped grabber instance

◆ m_remoteServer

ConfigurableRemoteServer* icl::io::GenericGrabber::m_remoteServer
private

<< internal protection for re-initialization


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