54 template <
class T>
inline T grabber_get_null(){
return 0; }
59 struct grabber_get_xxx_dummy{
60 grabber_get_xxx_dummy(){
61 grabber_get_null<core::format>();
62 grabber_get_null<core::depth>();
63 grabber_get_null<icl::utils::Size>();
67 template <
class T>
class GrabberHandle;
162 virtual void setDesiredFormatInternal(
core::format fmt);
165 virtual void setDesiredSizeInternal(
const utils::Size &size);
168 virtual void setDesiredDepthInternal(
core::depth d);
174 virtual core::depth getDesiredDepthInternal()
const;
177 virtual utils::Size getDesiredSizeInternal()
const;
182 template<
class X>
friend class GrabberHandle;
213 useDesired<T>(grabber_get_null<T>());
217 void ignoreDesired();
234 static std::string translateDoubleVec(
const std::vector<double> &doubleVec);
237 static std::vector<double> translateDoubleVec(
const std::string &doubleVecStr);
240 static std::string translateStringVec(
const std::vector<std::string> &stringVec);
243 static std::vector<std::string> translateStringVec(
const std::string &stringVecStr);
250 void enableUndistortion(
const std::string &filename);
269 void disableUndistortion();
272 bool isUndistortionEnabled()
const;
287 virtual void registerCallback(
callback cb);
290 virtual void removeAllCallbacks();
294 virtual void notifyNewImageAvailable(
const core::ImgBase *image);
315 template<>
inline void Grabber::useDesired<core::format>(
const core::format &t) { setDesiredFormatInternal(t); }
316 template<>
inline void Grabber::useDesired<core::depth>(
const core::depth &t) { setDesiredDepthInternal(t); }
317 template<>
inline void Grabber::useDesired<utils::Size>(
const utils::Size &t) { setDesiredSizeInternal(t); }
319 template<>
inline core::depth Grabber::getDesired<core::depth>()
const {
return getDesiredDepthInternal(); }
320 template<>
inline utils::Size Grabber::getDesired<utils::Size>()
const {
return getDesiredSizeInternal(); }
321 template<>
inline core::format Grabber::getDesired<core::format>()
const {
return getDesiredFormatInternal(); }
323 template<>
inline bool Grabber::desiredUsed<core::format>()
const{
return (
int)getDesired<core::format>() != -1; }
324 template<>
inline bool Grabber::desiredUsed<core::depth>()
const{
return (
int)getDesired<core::depth>() != -1; }
325 template<>
inline bool Grabber::desiredUsed<utils::Size>()
const{
return getDesired<utils::Size>() !=
utils::Size::null; }
327 class ICLIO_API GrabberRegister : utils::Uncopyable {
331 struct GrabberFunctions{
332 utils::Function<Grabber*,const std::string&> init;
333 utils::Function<const std::vector<GrabberDeviceDescription> &,std::string,
bool> list;
337 typedef std::map<std::string, GrabberFunctions> GFM;
341 typedef std::map<std::string, utils::Function<void,bool> > GBRM;
345 typedef std::set<std::string> GDS;
352 static GrabberRegister* getInstance();
354 void registerGrabberType(
const std::string &grabberid,
355 utils::Function<Grabber *, const std::string &> creator,
356 utils::Function<
const std::vector<GrabberDeviceDescription> &,std::string,
bool> device_list)
359 void registerGrabberBusReset(
const std::string &grabberid,
360 utils::Function<void, bool> reset_function)
363 void addGrabberDescription(
const std::string &grabber_description)
366 Grabber* createGrabber(
const std::string &grabberid,
const std::string ¶m) ;
368 std::vector<std::string> getRegisteredGrabbers();
370 std::vector<std::string> getGrabberInfos();
372 const std::vector<GrabberDeviceDescription>& getDeviceList(std::string
id, std::string hint=
"",
bool rescan=
true);
374 void resetGrabberBus(
const std::string &
id,
bool verbose);
381 #define REGISTER_GRABBER(NAME,CREATE_FUNC,DEVICE_LIST_FUNC,DESCRIPTION) \ 382 struct StaticGrabberRegistrationFor_##NAME{ \ 383 StaticGrabberRegistrationFor_##NAME(){ \ 384 icl::io::GrabberRegister::getInstance() -> registerGrabberType(#NAME, CREATE_FUNC, DEVICE_LIST_FUNC); \ 385 icl::io::GrabberRegister::getInstance() -> addGrabberDescription(DESCRIPTION); \ 387 } staticGrabberRegistrationFor_##NAME; 389 #define REGISTER_GRABBER_BUS_RESET_FUNCTION(NAME,BUS_RESET_FUNC) \ 390 struct StaticGrabberBusResetRegistrationFor_##NAME{ \ 391 StaticGrabberBusResetRegistrationFor_##NAME(){ \ 392 icl::io::GrabberRegister::getInstance() -> registerGrabberBusReset(#NAME, BUS_RESET_FUNC); \ 394 } staticGrabberBusResetRegistrationFor_##NAME; The General Function Template.
Definition: Function.h:284
void useDesired(const T &t)
sets desired parameters (only available for core::depth,utils::Size and core::format)
Definition: Grabber.h:204
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
static const Size null
null is w=0, h=0
Definition: Size.h:64
virtual const core::ImgBase * acquireImage()
main interface method, that is implemented by the actual grabber instances
Definition: Grabber.h:302
utils::Function< void, const core::ImgBase * > callback
new image callback type
Definition: Grabber.h:279
format
determines the color-format, that is associated with the images channels
Definition: Types.h:70
bool desiredUsed() const
returns whether the desired parameter for the given type is used
Definition: Grabber.h:200
T getDesired() const
returns the desired value for the given type T
Definition: Grabber.h:222
class representing a range with defined stepping
Definition: SteppingRange.h:46
const ProgArg pa(const std::string &id, unsigned int subargidx=0)
returns given program argument
Definition: ProgArg.h:304
#define ICLIO_API
Definition: CompatMacros.h:176
Common interface class for all grabbers.
Definition: Grabber.h:153
Size class of the ICL.
Definition: Size.h:61
Programm argument utility class.
Definition: ProgArg.h:80
scalemode
for scaling of Img images theses functions are provided
Definition: Types.h:84
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
void ignoreDesired()
set the grabber to ignore the desired param of type T
Definition: Grabber.h:212
Interface for classes that can be configured from configuration-files and GUI-Components.
Definition: Configurable.h:194
ICLQt_API core::Img< T > grab(const std::string &dev, const std::string &devSpec, const utils::Size &size=utils::Size::null, core::format fmt=core::formatRGB, bool releaseGrabber=false)
grabs a new image from given device (affinity for floats)
Common interface class for all grabbers.
Definition: GenericGrabber.h:55
Data * data
hidden data
Definition: Grabber.h:155
Represents a single property.
Definition: Configurable.h:200
Definition: ImageUndistortion.h:39
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131