Image Component Library (ICL)
|
Common interface class for all grabbers. More...
#include <GenericGrabber.h>
Public Member Functions | |
GenericGrabber (const utils::ProgArg &pa) throw (utils::ICLException) | |
<< internal protection for re-initialization | |
GenericGrabber (const std::string &devicePriorityList, const std::string ¶ms, 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 ¶ms, 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 | |
Grabber * | getGrabber () const |
returns the wrapped grabber itself | |
virtual | ~GenericGrabber () |
Destructor. | |
const core::ImgBase * | grab (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 > | |
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::Img32f * | getUndistortionWarpMap () 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 | |
Grabber * | m_poGrabber |
internally wrapped grabber instance | |
GrabberDeviceDescription | m_poDesc |
description of current Grabber | |
utils::Mutex | m_mutex |
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.
icl::io::GenericGrabber::GenericGrabber | ( | const utils::ProgArg & | pa | ) | throw (utils::ICLException) [inline] |
<< 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
icl::io::GenericGrabber::GenericGrabber | ( | ) | [inline] |
Empty default constructor, which creates a null-instance.
null instances of grabbers can be adapted using the init-function
virtual icl::io::GenericGrabber::~GenericGrabber | ( | ) | [virtual] |
Destructor.
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
void icl::io::GenericGrabber::disableUndistortion | ( | ) | [inline] |
disables distortion
void icl::io::GenericGrabber::enableUndistortion | ( | const std::string & | filename | ) | [inline] |
enables the undistorion
void icl::io::GenericGrabber::enableUndistortion | ( | const ImageUndistortion & | udist | ) | [inline] |
enables the undistortion plugin for the grabber using radial and tangential distortion parameters
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
void icl::io::GenericGrabber::enableUndistortion | ( | const core::Img32f & | warpMap | ) | [inline] |
enables undistortion for given warp map
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
core::depth icl::io::GenericGrabber::getDesiredDepthInternal | ( | ) | const [inline] |
returns the desired format
core::format icl::io::GenericGrabber::getDesiredFormatInternal | ( | ) | const [inline] |
returns the desired format
utils::Size icl::io::GenericGrabber::getDesiredSizeInternal | ( | ) | const [inline] |
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.
Grabber* icl::io::GenericGrabber::getGrabber | ( | ) | const [inline] |
returns the wrapped grabber itself
std::string icl::io::GenericGrabber::getType | ( | ) | const [inline] |
return the actual grabber type
const core::Img32f* icl::io::GenericGrabber::getUndistortionWarpMap | ( | ) | const [inline] |
returns the internal warp map or NULL if undistortion is not enabled
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
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
void icl::io::GenericGrabber::ignoreDesired | ( | ) | [inline] |
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
devicePriorityList | Comma 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:
|
params | comma 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:
notifyErrors | if set to false, no exception is thrown if no suitable device was found |
void icl::io::GenericGrabber::init | ( | const utils::ProgArg & | pa | ) | throw (utils::ICLException) |
this method works just like the other init method
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)'
bool icl::io::GenericGrabber::isNull | ( | ) | const [inline] |
returns wheter an underlying grabber could be created
bool icl::io::GenericGrabber::isUndistortionEnabled | ( | ) | const [inline] |
returns whether distortion is currently enabled
icl::io::GenericGrabber::operator bool | ( | ) | const [inline] |
simpler interface for isNull() (returns !isNull()
void icl::io::GenericGrabber::registerCallback | ( | Grabber::callback | cb | ) | [inline] |
passes registered callback to the internal pointer
void icl::io::GenericGrabber::removeAllCallbacks | ( | ) | [inline] |
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)
void icl::io::GenericGrabber::setDesiredDepthInternal | ( | core::depth | d | ) | [inline] |
internally set a desired format
void icl::io::GenericGrabber::setDesiredFormatInternal | ( | core::format | fmt | ) | [inline] |
internally set a desired format
void icl::io::GenericGrabber::setDesiredSizeInternal | ( | const utils::Size & | size | ) | [inline] |
internally set a desired format
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
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
utils::Mutex icl::io::GenericGrabber::m_mutex [mutable, private] |
description of current Grabber
Grabber* icl::io::GenericGrabber::m_poGrabber [private] |
internally wrapped grabber instance