Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes

ImgBase is the Image-Interface class that provides save access to underlying Img-template \. More...

#include <ImgBase.h>

Inheritance diagram for icl::core::ImgBase:
icl::core::Img< Type >

List of all members.

Public Member Functions

virtual ~ImgBase ()
 Destructor.
bool hasMetaData () const
 returns whether meta data has been associated to this image
void setMetaData (const std::string &data)
 associates new meta data with this image
void clearMetaData ()
 removes all meta data
const std::string & getMetaData () const
 returns associated meta data
std::string & getMetaData ()
 returns associated meta data (unconst)

Protected Member Functions

 ImgBase (depth d, const ImgParams &params)
 Creates an ImgBase object with specified image parameters.

Protected Attributes

ImgParams m_oParams
 all image params
depth m_eDepth
 depth of the image (depth8 for icl8u/depth32 for icl32f)
utils::Time m_timestamp
 timestamp of the image
std::string m_metaData
 additional information associated with this image

shallow copy

virtual ImgBaseshallowCopy (const utils::Rect &roi, const std::vector< int > &channelIndices, format fmt, utils::Time time=utils::Time::null, ImgBase **ppoDst=NULL)=0
const ImgBaseshallowCopy (const utils::Rect &roi, const std::vector< int > &channelIndices, format fmt, utils::Time time=utils::Time::null) const
ImgBasereinterpretChannels (format newFmt, ImgBase **ppoDst=NULL)
 Create a shallow copy of this image with a new format.
const ImgBasereinterpretChannels (format newFmt) const
 Create a shallow copy of this image with a new format (const version)
ImgBaseshallowCopy (const utils::Rect &roi, ImgBase **ppoDst=NULL)
 Create a shallow copy of the image.
ImgBaseshallowCopy (ImgBase **ppoDst=NULL)
const ImgBaseshallowCopy (const utils::Rect &roi) const
 Create a shallow copy of a const source image.
ImgBaseselectChannels (const std::vector< int > &channelIndices, ImgBase **ppoDst=0)
 Create a shallow copy of selected channels of an image.
ImgBaseselectChannel (int channelIndex, ImgBase **ppoDst=0)
 Create a shallow copy of a single image channel of an image.
const ImgBaseselectChannels (const std::vector< int > &channelIndices) const
 Create a shallow copy of selected channels of a const image.
const ImgBaseselectChannel (int channelIndex) const
 Create a shallow copy of a single image channel of a const image.

deep copy and depth conversion

virtual ImgBasedeepCopy (ImgBase **ppoDst=0) const =0
 Create a deep copy of a given image.
virtual ImgBasedeepCopyROI (ImgBase **ppoDst=0) const =0
 Create a deep copy of an images ROI.
template<class T >
Img< T > * convert (Img< T > *poDst=NULL) const
 returns an Img<T> instance of this image (type-conversion or deep copy)
ImgBaseconvert (depth d) const
 returns a converted (or deep copied) instance of this image
ImgBaseconvert (ImgBase *poDst) const
 converts image data into the given destination image
template<class T >
Img< T > * convertROI (Img< T > *poDst=NULL) const
 returns a converted (or deep copied) instance of this images ROI
ImgBaseconvertROI (depth d) const
 returns a converted (or deep copied) instance of this images ROI
ImgBaseconvertROI (ImgBase *poDst) const
 converts this images ROI into a given destination image
virtual ImgBasescaledCopy (const utils::Size &newSize, scalemode eScaleMode=interpolateNN) const =0
 Create a scaled copy with given size of an image.
virtual ImgBasescaledCopy (ImgBase **ppoDst=0, scalemode eScaleMode=interpolateNN) const =0
 Create a scaled copy into a given destination image.
virtual ImgBasescaledCopyROI (const utils::Size &newSize, scalemode eScaleMode=interpolateNN) const =0
 Create a scaled copy with given size of an images ROI.
virtual ImgBasescaledCopyROI (ImgBase **ppoDst=0, scalemode eScaleMode=interpolateNN) const =0
 Create a scaled copy of an images ROI with optionally given destination image.

asImg<T> cast templates

template<class T >
Img< T > * asImg ()
 dynamically casts this image to one of its Img<T> subclasses
template<class T >
const Img< T > * asImg () const
 dynamically casts this image to one of its Img<T> subclasses (const version)
Img< icl8u > * as8u ()
 convenience shortcut version for asImg<icl8u>()
Img< icl16s > * as16s ()
 convenience shortcut version for asImg<icl16s>()
Img< icl32s > * as32s ()
 convenience shortcut version for asImg<icl32s>()
Img< icl32f > * as32f ()
 convenience shortcut version for asImg<icl32f>()
Img< icl64f > * as64f ()
 convenience shortcut version for asImg<icl64f>()
const Img< icl8u > * as8u () const
 convenience shortcut version for asImg<icl8u>()
const Img< icl16s > * as16s () const
 convenience shortcut version for asImg<icl16s>()
const Img< icl32s > * as32s () const
 convenience shortcut version for asImg<icl32s>()
const Img< icl32f > * as32f () const
 convenience shortcut version for asImg<icl32f>()
const Img< icl64f > * as64f () const
 convenience shortcut version for asImg<icl64f>()

getter (without ROI handling)

const ImgParamsgetParams () const
 returns all params in terms of a const ImgParams reference
const utils::SizegetSize () const
 returns the size of the images
int getWidth () const
 returns the images width
int getHeight () const
 returns the images height
int getDim () const
 returns the pixel count of each channel
int getChannels () const
 returns the channel count of the image
depth getDepth () const
 returns the depth (depth8u or depth32f)
format getFormat () const
 returns the current (color)-format of this image
utils::Time getTime () const
 returns the timestamp of the image
virtual int getLineStep () const =0
 returns the length of an image line in bytes (width*sizeof(Type))

ROI handling

const utils::RectgetROI () const
 returns the images ROI rectangle
void getROI (utils::Point &offset, utils::Size &size) const
 copies the current ROI into the given offset and size references
utils::Point getROIOffset () const
 returns the images ROI offset (upper left corner)
utils::Size getROISize () const
 returns the images ROI size
int getROIWidth () const
 returns the images ROI width
int getROIHeight () const
 returns the images ROI height
int getROIXOffset () const
 returns the images ROI XOffset
int getROIYOffset () const
 returns the images ROI YOffset
utils::Rect getImageRect () const
 returns the image rect (0,0,width, height)
void setROIOffset (const utils::Point &offset)
 sets the image ROI offset to the given value
void setROISize (const utils::Size &size)
 sets the image ROI size to the given value
void setROI (const utils::Point &offset, const utils::Size &size)
 set both image ROI offset and size
void setROI (const utils::Rect &roi)
 sets the image ROI to the given rectangle
void setROIOffsetAdaptive (const utils::Point &offset)
 checks, eventually adapts and finally sets the image ROI size
void setROISizeAdaptive (const utils::Size &size)
 checks, eventually adapts and finally sets the image ROI size
void setROIAdaptive (const utils::Rect &roi)
 checks, eventually adapts and finally sets the image ROI size
int hasFullROI () const
 returns ROISize == ImageSize
void setFullROI ()
 resets the image ROI to the whole image size with offset (0,0)

border functions

virtual void fillBorder (bool setFullROI=true)=0
 extrudes ROI borders through non-ROI borders
virtual void fillBorder (icl64f val, bool setFullROI=true)=0
 fills all non-ROI pixels with a given value
virtual void fillBorder (const std::vector< icl64f > &vals, bool setFullROI=true)=0
 fills all non-ROI pixels with a given value
virtual void fillBorder (const ImgBase *src, bool setFullROI=true)=0
 copies images non-border pixels from source image.

data access

virtual const void * getDataPtr (int iChannel) const =0
 returns a pointer to first data element of a given channel
virtual void * getDataPtr (int iChannel)=0
 returns a pointer to first data element of a given channel

channel management

virtual void detach (int iIndex=-1)=0
 Makes the image channels independent from other images.
virtual void removeChannel (int iChannel)=0
 Removes a specified channel.
virtual void swapChannels (int iIndexA, int iIndexB)=0
 Swap channel A and B.
void setParams (const ImgParams &params)
 sets all image parameters in order channels,size,format,roi
virtual void setChannels (int iNewNumChannels)=0
 sets the channel count to a new value
virtual void setSize (const utils::Size &s)=0
 resizes the image to new size (image data is lost!)
void setFormat (format fmt)
 sets the format associated with channels of the image
void setTime (const utils::Time time)
 sets the timestamp of the image
void setTime ()
 sets timestamp of the image to the current time

min and max element

icl64f getMax (int iChannel, utils::Point *coords=0) const
 Returns max pixel value of channel iChannel within ROI.
icl64f getMin (int iChannel, utils::Point *coords=0) const
 Returns min pixel value of channel iChannel within ROI.
icl64f getMin () const
 return maximal pixel value over all channels (restricted to ROI)
icl64f getMax () const
 return minimal pixel value over all channels (restricted to ROI)
const utils::Range< icl64fgetMinMax (int iChannel, utils::Point *minCoords=0, utils::Point *maxCoords=0) const
 Returns min and max pixel values of channel iChannel within ROI.
const utils::Range< icl64fgetMinMax () const
 Returns min and max pixel values of all channels within ROI.

in-place image adaption

virtual void scale (const utils::Size &s, scalemode eScaleMode=interpolateNN)=0
 performs an in-place resize operation on the image (IPP-OPTIMIZED)
virtual void mirror (axis eAxis, bool bOnlyROI=false)=0
 performs an in-place mirror operation
void clear (int iChannel=-1, icl64f val=0, bool bROIOnly=true)
 Sets the ROI pixels of one or all channels to a specified value.
void normalizeAllChannels (const utils::Range< icl64f > &dstRange)
 Normalize the channel min/ max range to the new min, max range.
void normalizeChannel (int iChannel, const utils::Range< icl64f > &srcRange, const utils::Range< icl64f > &dstRange)
 Normalize the channel from a given min/max range to the new range.
void normalizeChannel (int iChannel, const utils::Range< icl64f > &dstRange)
 Normalize the channel from a given min/max range to the new range.
void normalizeImg (const utils::Range< icl64f > &srcRange, const utils::Range< icl64f > &dstRange)
 Normalize the image from a given min/max range to the new range.
void normalizeImg (const utils::Range< icl64f > &dstRange)
 Normalize the image from a min/max range to the new range.

utility functions

void print (const std::string sTitle="image") const
 prints the image to std-out
bool validChannel (const int iChannel) const
 validate the given channel index
bool isEqual (const utils::Size &s, int nChannels) const
 returns if two images have same size, and channel count
bool isEqual (const ImgParams &params)
 checks if the image has the given parameters
bool isEqual (const ImgParams &params, depth d)
 checks if the image has given params and depth
bool isEqual (const ImgBase *otherImage)
 checks if the image has given params and depth as another image
virtual bool isIndependent () const =0
 returns whether image data is currently shared

Detailed Description

ImgBase is the Image-Interface class that provides save access to underlying Img-template \.

Class

The ImgBase class provides access to the following basic image features:

How to use the ImgBase class.

As the ImgBase is an abstract class, no ImgBase objects can be instantiated It merely provides a common interface to methods provided by the inherited classe Img<T>. It can be used in all functions the abstract about the underlying data type. E.g. consider a scaling operation on images: When regarding an image as a continuous 2D function, it is not necessary to know the images data type when scaling it. However the developer might say: "At the latest if I want to implement some kind of interpolation I have to know the actual data type I'm working on".
The ImgBase class implements exactly this kind of abstraction from the underlying implementation. Although the implementation has indeed to tackle each of the different data types (E.g. floating point types vs. integer types) in an appropriate way, it is possible to call such function directly on the abstract ImgBase object.
Many other operations are also conceptually independent on the concrete pixel type, e.g. recombining or selecting channels For these operations the ImgBase class provides abstract or implemented methods ensuring a common and type-independent interface.

For example, to resize an image, one can easily write:

        void any_function(ImgBase *poBase){
            poBase->setSize(Size(640,480));
            ...
        }

Examples

The following example should explain how to work with ImgBase class.

        void special_function_8u(Img8u* poImage){...}
        void special_function_16s(Img16f* poImage){...}
        ...
        void special_function_64f(Img64f* poImage){...}
        
        void generic_function(ImgBase *poImage){
           switch(poImage->getDepth()){
              case depth8u:  special_function_8u(poImage->asImg<icl8u>());
              case depth16s: special_function_8u(poImage->asImg<icl16s>());
              ...
              case depth64f: special_function_(poImage->asImg<icl64f>());
          }
        }

Template functions can be called in an analogous way:

        template<class T> void template_function(Img<T> *poImg){...}
        
        void generic_function(ImgBase *poImage){
           switch(poImage->getDepth()){
              case depth8u:  template_function(poImage->asImg<icl8u>());
              case depth16s: template_function(poImage->asImg<icl16s>());
              ...
              case depth64f: template_function(poImage->asImg<icl64f>());
          }
        }

Constructor & Destructor Documentation

virtual icl::core::ImgBase::~ImgBase ( ) [virtual]

Destructor.

icl::core::ImgBase::ImgBase ( depth  d,
const ImgParams params 
) [protected]

Creates an ImgBase object with specified image parameters.


Member Function Documentation

convenience shortcut version for asImg<icl16s>()

const Img<icl16s>* icl::core::ImgBase::as16s ( ) const [inline]

convenience shortcut version for asImg<icl16s>()

convenience shortcut version for asImg<icl32f>()

const Img<icl32f>* icl::core::ImgBase::as32f ( ) const [inline]

convenience shortcut version for asImg<icl32f>()

convenience shortcut version for asImg<icl32s>()

const Img<icl32s>* icl::core::ImgBase::as32s ( ) const [inline]

convenience shortcut version for asImg<icl32s>()

convenience shortcut version for asImg<icl64f>()

const Img<icl64f>* icl::core::ImgBase::as64f ( ) const [inline]

convenience shortcut version for asImg<icl64f>()

convenience shortcut version for asImg<icl8u>()

const Img<icl8u>* icl::core::ImgBase::as8u ( ) const [inline]

convenience shortcut version for asImg<icl8u>()

template<class T >
Img<T>* icl::core::ImgBase::asImg ( ) [inline]

dynamically casts this image to one of its Img<T> subclasses

This function performs an emulated dynamic_cast on this image and returns a Img<T>*. If this image can not be casted to the the template type that is specified by the template parameter T, a NULL-pointer is returned. To avoid an expensive RTTI-runtime check using dynamic_cast, this images depth is compared the the depth associated the the template parameter T.

Returns:
Img<T>* instance of this image
template<class T >
const Img<T>* icl::core::ImgBase::asImg ( ) const [inline]

dynamically casts this image to one of its Img<T> subclasses (const version)

const version of the above function

Returns:
const Img<T>* instance of this image
void icl::core::ImgBase::clear ( int  iChannel = -1,
icl64f  val = 0,
bool  bROIOnly = true 
)

Sets the ROI pixels of one or all channels to a specified value.

Parameters:
iChannelChannel to fill with zero (default: -1 = all channels)
valdestination value (default: 0)
bROIOnlyif set false, the whole image is set to val

removes all meta data

template<class T >
Img<T>* icl::core::ImgBase::convert ( Img< T > *  poDst = NULL) const

returns an Img<T> instance of this image (type-conversion or deep copy)

If the requested type differs from the actual image type, then a type conversion is performed to transfer the image data to poDst. Else deepCopy is called, to transfer the image data. If poDst is NULL, it is created with identical parameters, except for the images depth, which is given by the template parameter T. (For developers: The convert function builds the base function for other higher level functions like deepCopy. Internally it calls the icl namespace function deepCopyChannel, which decides if data has to be copied or converted.)

Parameters:
poDstdestination image. If NULL, then a deep copy of the current image is returned
Returns:
converted image
See also:
deepCopy

returns a converted (or deep copied) instance of this image

This function can be called using an explicit destination depth. The function switches the depth parameter and calls the associated convert<T> template function

Parameters:
dnew images depth
Returns:
converted image

converts image data into the given destination image

Parameters:
poDstdestination image (exploited if not NULL else a deep copy of this is returned)
Returns:
converted image
template<class T >
Img<T>* icl::core::ImgBase::convertROI ( Img< T > *  poDst = NULL) const

returns a converted (or deep copied) instance of this images ROI

This function behaves essentially like the above functions, except it is applied on the source image ROI only.

Parameters:
poDstoptionally given destination image pointer.
Returns:
converted image, containing the source images ROI

returns a converted (or deep copied) instance of this images ROI

This function behaves essentially like the above functions, except it is applied on the source image ROI only.

Parameters:
dnew images depth
Returns:
converted image, containing the source images ROI

converts this images ROI into a given destination image

The destination image is exploited if not NULL, else a deep copy of this is created and returned.

Parameters:
poDstdestination image (its depth is hold, other parameters are adapted)
Returns:
converted image (poDst if it was not NULL) that was adapted to this images ROI size, channels, format and Time
virtual ImgBase* icl::core::ImgBase::deepCopy ( ImgBase **  ppoDst = 0) const [pure virtual]

Create a deep copy of a given image.

An optional destination image can be given via ppoDst. If ppoDst is NULL, a new image created and returned. If ppoDst points to NULL, the new image is created at *ppoDst. Otherwise, the given destination image (*ppoDst) is adapted to this images params including its depth. If the destination images depth differs from this images depth, (*ppoDst) is first released and then created new on the heap

Parameters:
ppoDstoptionally given destination image
Returns:
deep copied image

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual ImgBase* icl::core::ImgBase::deepCopyROI ( ImgBase **  ppoDst = 0) const [pure virtual]

Create a deep copy of an images ROI.

This function creates copies this images ROI into an optional given destination image. If ppoDst is NULL, a new image is created. If it points to NULL, a new image is created at *ppoDst. Otherwise the destination image is adapted in size, channels and depth to this image (the size is set to this images ROI size). The copy operation is performed line-wise using memcpy, what makes deepCopyROI very fast.

Parameters:
ppoDstoptionally given destination image
Returns:
image containing a deep copy of the source images ROI

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::detach ( int  iIndex = -1) [pure virtual]

Makes the image channels independent from other images.

Parameters:
iIndexindex of the channel, that should be detached. (If iIndex is an legal channel index only the corresponding channel will be detached. If iIndex is -1 (default) all channels are detached

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::fillBorder ( bool  setFullROI = true) [pure virtual]

extrudes ROI borders through non-ROI borders

This function can be used fill all image border pixles (pixels outside the current ROI with the value of the closest ROI-pixel

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::fillBorder ( icl64f  val,
bool  setFullROI = true 
) [pure virtual]
virtual void icl::core::ImgBase::fillBorder ( const std::vector< icl64f > &  vals,
bool  setFullROI = true 
) [pure virtual]

fills all non-ROI pixels with a given value

here, for each channel a given value is used, so vals.size() must be at least this->getChannels()

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::fillBorder ( const ImgBase src,
bool  setFullROI = true 
) [pure virtual]

copies images non-border pixels from source image.

The source image must provided pixel values for each non border pixel of this image. So the source images size must be at least (X+1)x(Y+1) where (X,Y) is the lower right non-border pixel of this image.

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

int icl::core::ImgBase::getChannels ( ) const [inline]

returns the channel count of the image

virtual const void* icl::core::ImgBase::getDataPtr ( int  iChannel) const [pure virtual]

returns a pointer to first data element of a given channel

See also:
Img

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void* icl::core::ImgBase::getDataPtr ( int  iChannel) [pure virtual]

returns a pointer to first data element of a given channel

See also:
Img

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

depth icl::core::ImgBase::getDepth ( ) const [inline]

returns the depth (depth8u or depth32f)

int icl::core::ImgBase::getDim ( ) const [inline]

returns the pixel count of each channel

returns the current (color)-format of this image

int icl::core::ImgBase::getHeight ( ) const [inline]

returns the images height

returns the image rect (0,0,width, height)

virtual int icl::core::ImgBase::getLineStep ( ) const [pure virtual]

returns the length of an image line in bytes (width*sizeof(Type))

This information is compulsory for calling any IPP function.

Returns:
getWidth()*sizeof(Type) in the underlying Img template

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

icl64f icl::core::ImgBase::getMax ( int  iChannel,
utils::Point coords = 0 
) const

Returns max pixel value of channel iChannel within ROI.

Parameters:
iChannelIndex of channel
coords(optinal) if not null, the pixel position of the max is written into this argument

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

return minimal pixel value over all channels (restricted to ROI)

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

const std::string& icl::core::ImgBase::getMetaData ( ) const [inline]

returns associated meta data

std::string& icl::core::ImgBase::getMetaData ( ) [inline]

returns associated meta data (unconst)

icl64f icl::core::ImgBase::getMin ( int  iChannel,
utils::Point coords = 0 
) const

Returns min pixel value of channel iChannel within ROI.

Parameters:
iChannelIndex of channel
coords(optinal) if not null, the pixel position of the min is written into this argument

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

return maximal pixel value over all channels (restricted to ROI)

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

const utils::Range<icl64f> icl::core::ImgBase::getMinMax ( int  iChannel,
utils::Point minCoords = 0,
utils::Point maxCoords = 0 
) const

Returns min and max pixel values of channel iChannel within ROI.

Parameters:
iChannelIndex of channel
minCoords(optinal) if not null, the pixel position of the min is written into this argument
maxCoords(optinal) if not null, the pixel position of the max is written into this argument
Returns:
channel range in terms of a Range<icl64f> struct

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

Returns min and max pixel values of all channels within ROI.

Returns:
image range in terms of a Range<icl64f> struct

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

const ImgParams& icl::core::ImgBase::getParams ( ) const [inline]

returns all params in terms of a const ImgParams reference

This enables the programmer to write

          imageA.setParams(imageB.getParams());
          
const utils::Rect& icl::core::ImgBase::getROI ( ) const [inline]

returns the images ROI rectangle

void icl::core::ImgBase::getROI ( utils::Point offset,
utils::Size size 
) const [inline]

copies the current ROI into the given offset and size references

int icl::core::ImgBase::getROIHeight ( ) const [inline]

returns the images ROI height

returns the images ROI offset (upper left corner)

returns the images ROI size

int icl::core::ImgBase::getROIWidth ( ) const [inline]

returns the images ROI width

int icl::core::ImgBase::getROIXOffset ( ) const [inline]

returns the images ROI XOffset

int icl::core::ImgBase::getROIYOffset ( ) const [inline]

returns the images ROI YOffset

const utils::Size& icl::core::ImgBase::getSize ( ) const [inline]

returns the size of the images

returns the timestamp of the image

int icl::core::ImgBase::getWidth ( ) const [inline]

returns the images width

int icl::core::ImgBase::hasFullROI ( ) const [inline]

returns ROISize == ImageSize

bool icl::core::ImgBase::hasMetaData ( ) const [inline]

returns whether meta data has been associated to this image

bool icl::core::ImgBase::isEqual ( const utils::Size s,
int  nChannels 
) const [inline]

returns if two images have same size, and channel count

Parameters:
ssize to test
nChannelschannel count to test
bool icl::core::ImgBase::isEqual ( const ImgParams params) [inline]

checks if the image has the given parameters

bool icl::core::ImgBase::isEqual ( const ImgParams params,
depth  d 
) [inline]

checks if the image has given params and depth

bool icl::core::ImgBase::isEqual ( const ImgBase otherImage) [inline]

checks if the image has given params and depth as another image

virtual bool icl::core::ImgBase::isIndependent ( ) const [pure virtual]

returns whether image data is currently shared

This function does only return true, if all channel pointers have reference count 1 -- i.e. all channels are currently not shared with another image

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::mirror ( axis  eAxis,
bool  bOnlyROI = false 
) [pure virtual]

performs an in-place mirror operation

This function is an in-place version of the flippedCopy function, that is also provided in this class. Its performance is comparable to the out-place function

Parameters:
eAxisaxis for the mirror operations
bOnlyROIif set, only the ROI of this image is mirrored, else the whole image is mirrored.

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

Normalize the channel min/ max range to the new min, max range.

The min/ max range from the source channels are automatically detected, separately for each channel.

Parameters:
dstRangerange of all channels after the operation
void icl::core::ImgBase::normalizeChannel ( int  iChannel,
const utils::Range< icl64f > &  srcRange,
const utils::Range< icl64f > &  dstRange 
)

Normalize the channel from a given min/max range to the new range.

Parameters:
iChannelchannel index
srcRangeassumption of the current range of the channel
dstRangerange of the channel after the operation
void icl::core::ImgBase::normalizeChannel ( int  iChannel,
const utils::Range< icl64f > &  dstRange 
)

Normalize the channel from a given min/max range to the new range.

The min/ max range from the source channel is automatically detected, separately for this channel. (Internally: this function calls normalizeChannel with srcRage = this->getMinMax(iChannel) )

Parameters:
iChannelchannel index
dstRangerange of the channel after the operation
void icl::core::ImgBase::normalizeImg ( const utils::Range< icl64f > &  srcRange,
const utils::Range< icl64f > &  dstRange 
)

Normalize the image from a given min/max range to the new range.

Parameters:
srcRangeassumption of the current image range
dstRangerange of the image after the operation
void icl::core::ImgBase::normalizeImg ( const utils::Range< icl64f > &  dstRange)

Normalize the image from a min/max range to the new range.

The min/ max range from the image is automatically detected, combined over all image channels. (Internally: this function calls normalizeImg with srcRage = this->getMinMax() )

Parameters:
dstRangerange of the image after the operation
void icl::core::ImgBase::print ( const std::string  sTitle = "image") const

prints the image to std-out

Parameters:
sTitleoptional title, that can be printed before printing the image parameters to identify the message.
ImgBase* icl::core::ImgBase::reinterpretChannels ( format  newFmt,
ImgBase **  ppoDst = NULL 
) [inline]

Create a shallow copy of this image with a new format.

Parameters:
newFmtnew format to choose. This must be compatible to the channel count of this image.
ppoDstdestination image (exploited as possible)
Returns:
shallow copie with given format of NULL if an error occured
const ImgBase* icl::core::ImgBase::reinterpretChannels ( format  newFmt) const [inline]

Create a shallow copy of this image with a new format (const version)

Parameters:
newFmtnew format to choose. This must be compatible to the channel count of this image.
Returns:
shallow copie with given format of NULL if an error occured
virtual void icl::core::ImgBase::removeChannel ( int  iChannel) [pure virtual]

Removes a specified channel.

If a non-matrix format image looses a channel, the new channel count will not match to the channel count, that is associated with the current format. In this case, a warning is written to std::out, and the format will be set to formatMatrix implicitly. To avoid this warning the programmer has to change the format explicitly before to formatMatrix.

Parameters:
iChannelIndex of channel to remove

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::scale ( const utils::Size s,
scalemode  eScaleMode = interpolateNN 
) [pure virtual]

performs an in-place resize operation on the image (IPP-OPTIMIZED)

The image size is adapted on demand to the given size, and the image data is scaled. This function is SLOW in comparison to the scaledCopy function that is also provided in this class, as an additional scaling buffer is allocated and released at runtime.

Parameters:
snew size of this image
eScaleModeinterpolation method to use for the scaling operation

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual ImgBase* icl::core::ImgBase::scaledCopy ( const utils::Size newSize,
scalemode  eScaleMode = interpolateNN 
) const [pure virtual]

Create a scaled copy with given size of an image.

Parameters:
newSizesize of the new image
eScaleModeinterpolation method to use when scaling the image
Returns:
scaled image

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual ImgBase* icl::core::ImgBase::scaledCopy ( ImgBase **  ppoDst = 0,
scalemode  eScaleMode = interpolateNN 
) const [pure virtual]

Create a scaled copy into a given destination image.

If the given destination pointer ppoDst is NULL, a deep copy of this image is returned. If ppoDst points to NULL, a new a deep copy of this image is created at *ppoDst. Otherwise, the destination image is only adapted in its depth to this image; its size is hold.

Parameters:
ppoDstoptionally given destination image pointer
eScaleModeinterpolation method to use when scaling the image
Returns:
scaled image

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual ImgBase* icl::core::ImgBase::scaledCopyROI ( const utils::Size newSize,
scalemode  eScaleMode = interpolateNN 
) const [pure virtual]

Create a scaled copy with given size of an images ROI.

This function behaves identically to the scaledCopy function above, except it is applied on the source images ROI only.

Parameters:
newSizesize of the new image
eScaleModeinterpolation method to use when scaling the image
Returns:
image containing a scaled instance of the source images ROI

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual ImgBase* icl::core::ImgBase::scaledCopyROI ( ImgBase **  ppoDst = 0,
scalemode  eScaleMode = interpolateNN 
) const [pure virtual]

Create a scaled copy of an images ROI with optionally given destination image.

This function behaves identically to the scaledCopy function above, except it is applied on the source images ROI only.

Parameters:
ppoDstoptionally given destination image pointer
eScaleModeinterpolation method to use when scaling the image
Returns:
image containing a scaled instance of the source images ROI

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

ImgBase* icl::core::ImgBase::selectChannel ( int  channelIndex,
ImgBase **  ppoDst = 0 
) [inline]

Create a shallow copy of a single image channel of an image.

This function is a shortcut to use icl::ImgBase::selectChannels(const std::vector<int>&,icl::ImgBase**) to select a single channel from an image

Parameters:
channelIndexindex of the channel to select (if invalid, NULL is returned)
ppoDstdestination image
Returns:
image containing only the selected channel
const ImgBase* icl::core::ImgBase::selectChannel ( int  channelIndex) const [inline]

Create a shallow copy of a single image channel of a const image.

This function is a shortcut to use icl::ImgBase::selectChannels(const std::vector<int>&)const to select a single channel from a const image image

Parameters:
channelIndexindex of the channel to select (if invalid, NULL is returned)
Returns:
const image containing only the selected channel

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

ImgBase* icl::core::ImgBase::selectChannels ( const std::vector< int > &  channelIndices,
ImgBase **  ppoDst = 0 
) [inline]

Create a shallow copy of selected channels of an image.

This function can be used if only one or some channels of a given const image should be used in further processing steps. It helps to avoid the necessity of "deepCopy" calls there.

Parameters:
channelIndicesvector containing channel indices to copy
ppoDstdestination image (if Null, a new one is created)
Returns:
image containing only the selected channels (as shallow copies) format of that image becomes formatMatrix
See also:
shallowCopy
const ImgBase* icl::core::ImgBase::selectChannels ( const std::vector< int > &  channelIndices) const [inline]

Create a shallow copy of selected channels of a const image.

Parameters:
channelIndicesvector containing channel indices to copy
Returns:
const image containing only the selected channels

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::setChannels ( int  iNewNumChannels) [pure virtual]

sets the channel count to a new value

This function works only on demand, that means, that channels will only be created/deleted, if the new channel count differs from the current. If the current image has a non-matrix format, then the new channel count must match to the channel count associated with this format. If not, a warning is written to std::out, and the format is set to formatMatrix implicitly. To avoid this warning, the image format must be set to formatMatrix explicitly before calling setChannels

Parameters:
iNewNumChannelsnew channel count

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

sets the format associated with channels of the image

The channel count of the image is set to the channel count associated with the set format, if they differ. E.g an image with one channel will have 3 channels after a setFormat(formatRGB) - call.

Parameters:
fmtnew format value
See also:
getChannelsOfFormat
void icl::core::ImgBase::setFullROI ( ) [inline]

resets the image ROI to the whole image size with offset (0,0)

void icl::core::ImgBase::setMetaData ( const std::string &  data) [inline]

associates new meta data with this image

void icl::core::ImgBase::setParams ( const ImgParams params)

sets all image parameters in order channels,size,format,roi

void icl::core::ImgBase::setROI ( const utils::Point offset,
const utils::Size size 
) [inline]

set both image ROI offset and size

void icl::core::ImgBase::setROI ( const utils::Rect roi) [inline]

sets the image ROI to the given rectangle

void icl::core::ImgBase::setROIAdaptive ( const utils::Rect roi) [inline]

checks, eventually adapts and finally sets the image ROI size

See also:
ImgParams
void icl::core::ImgBase::setROIOffset ( const utils::Point offset) [inline]

sets the image ROI offset to the given value

void icl::core::ImgBase::setROIOffsetAdaptive ( const utils::Point offset) [inline]

checks, eventually adapts and finally sets the image ROI size

See also:
ImgParams
void icl::core::ImgBase::setROISize ( const utils::Size size) [inline]

sets the image ROI size to the given value

void icl::core::ImgBase::setROISizeAdaptive ( const utils::Size size) [inline]

checks, eventually adapts and finally sets the image ROI size

See also:
ImgParams
virtual void icl::core::ImgBase::setSize ( const utils::Size s) [pure virtual]

resizes the image to new size (image data is lost!)

operation is performed on demand - if the image has already the given size, then nothing is done at all. For resizing operation with scaling of the image data use scale. Note: The ROI of the image is set to the hole image using delROI(), notwithstanding if a resize operation was performed or not.

Parameters:
snew image size (if x or y is < 0, the original width/height is used)
See also:
scale

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

void icl::core::ImgBase::setTime ( const utils::Time  time) [inline]

sets the timestamp of the image

void icl::core::ImgBase::setTime ( ) [inline]

sets timestamp of the image to the current time

virtual ImgBase* icl::core::ImgBase::shallowCopy ( const utils::Rect roi,
const std::vector< int > &  channelIndices,
format  fmt,
utils::Time  time = utils::Time::null,
ImgBase **  ppoDst = NULL 
) [pure virtual]

Create a shallow copy of an image with given

Parameters:
ppoDstdestination image which is exploited if possible, or otherwise reallocated
roiROI of the new Image
channelIndicesindices to select from the source image. These channels are shallow-copied into the destination image
fmtformat of the new image (the channel count that is associated with this format must be equal to the channel count that is implicitely defined by the size of the vector channelIndices
timenew timestamp for the returned image
Returns:
shallow-copied image

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

const ImgBase* icl::core::ImgBase::shallowCopy ( const utils::Rect roi,
const std::vector< int > &  channelIndices,
format  fmt,
utils::Time  time = utils::Time::null 
) const [inline]

Create a shallow copy of an image with given (const version)

See also:
the above function
Parameters:
roiROI of the new Image
channelIndicesindices to select from the source image. These channels are shallow-copied into the destination image (if size is null, all channels are selected)
fmtformat of the new image (the channel count that is associated with this format must be equal to the channel count that is implicitely defined by the size of the vector channelIndices
timenew timestamp for the returned image
Returns:
shallow-copied image

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

ImgBase* icl::core::ImgBase::shallowCopy ( const utils::Rect roi,
ImgBase **  ppoDst = NULL 
) [inline]

Create a shallow copy of the image.

It exploits the given destination image if possible, i.e. if the pixel depth matches. Else this image is released and a new one is created. Optionally a second argument can be specified to get a new image with the given ROI.

Parameters:
ppoDstpointer to the destination image pointer If ppoDst is NULL, a new image is created, if ppoDst points to NULL, a new image is created at *ppoDst;
roinew ROI of the new image. If Rect::null, the source images roi is used.
Returns:
shallow copy of this image
ImgBase* icl::core::ImgBase::shallowCopy ( ImgBase **  ppoDst = NULL) [inline]
const ImgBase* icl::core::ImgBase::shallowCopy ( const utils::Rect roi) const [inline]

Create a shallow copy of a const source image.

In contrast to the not const function shallowCopy, the const one does not provide to specify a destination image pointer, because this must neither be const nor not const. If it would be const, it would not be possible to adapt it to correct parameters, otherwise it would violate the const concept as it could be used to change the const result.
This function can only be used to get const copy of a source image with a special ROI.

Parameters:
roiROI of the returned image (Rect::null is not allowed!)
Returns:
shallow copy of this image with specified ROI

Reimplemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

virtual void icl::core::ImgBase::swapChannels ( int  iIndexA,
int  iIndexB 
) [pure virtual]

Swap channel A and B.

The channel swap operation is shallow; only the channel pointers are swapped.

Parameters:
iIndexAIndex of channel A;
iIndexBIndex of channel B

Implemented in icl::core::Img< Type >, icl::core::Img< ICL_QUICK_TYPE >, icl::core::Img< T >, icl::core::Img< icl32f >, and icl::core::Img< icl8u >.

bool icl::core::ImgBase::validChannel ( const int  iChannel) const [inline]

validate the given channel index


Member Data Documentation

depth of the image (depth8 for icl8u/depth32 for icl32f)

std::string icl::core::ImgBase::m_metaData [protected]

additional information associated with this image

all image params

the params class consists of

  • image size
  • number of image channels
  • image format
  • image ROI

timestamp of the image


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