Image Component Library (ICL)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
icl::core::ImgBase Class Referenceabstract

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 > icl::core::Img< icl32f > icl::core::Img< icl8u > icl::core::Img< ICL_QUICK_TYPE > icl::core::Img< T > icl::utils::UncopiedInstance< icl::core::Img >

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

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. More...
 
const ImgBasereinterpretChannels (format newFmt) const
 Create a shallow copy of this image with a new format (const version) More...
 
ImgBaseshallowCopy (const utils::Rect &roi, ImgBase **ppoDst=NULL)
 Create a shallow copy of the image. More...
 
ImgBaseshallowCopy (ImgBase **ppoDst=NULL)
 
const ImgBaseshallowCopy (const utils::Rect &roi) const
 Create a shallow copy of a const source image. More...
 
ImgBaseselectChannels (const std::vector< int > &channelIndices, ImgBase **ppoDst=0)
 Create a shallow copy of selected channels of an image. More...
 
ImgBaseselectChannel (int channelIndex, ImgBase **ppoDst=0)
 Create a shallow copy of a single image channel of an image. More...
 
const ImgBaseselectChannels (const std::vector< int > &channelIndices) const
 Create a shallow copy of selected channels of a const image. More...
 
const ImgBaseselectChannel (int channelIndex) const
 Create a shallow copy of a single image channel of a const image. More...
 

deep copy and depth conversion

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

asImg<T> cast templates

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

getter (without ROI handling)

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

ROI handling

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

border functions

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

data access

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

channel management

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

min and max element

icl64f getMax (int iChannel, utils::Point *coords=0) const
 Returns max pixel value of channel iChannel within ROI. More...
 
icl64f getMin (int iChannel, utils::Point *coords=0) const
 Returns min pixel value of channel iChannel within ROI. More...
 
icl64f getMin () const
 return maximal pixel value over all channels (restricted to ROI) More...
 
icl64f getMax () const
 return minimal pixel value over all channels (restricted to ROI) More...
 
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. More...
 
const utils::Range< icl64fgetMinMax () const
 Returns min and max pixel values of all channels within ROI. More...
 

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) More...
 
virtual void mirror (axis eAxis, bool bOnlyROI=false)=0
 performs an in-place mirror operation More...
 
void clear (int iChannel=-1, icl64f val=0, bool bROIOnly=true)
 Sets the ROI pixels of one or all channels to a specified value. More...
 
void normalizeAllChannels (const utils::Range< icl64f > &dstRange)
 Normalize the channel min/ max range to the new min, max range. More...
 
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. More...
 
void normalizeChannel (int iChannel, const utils::Range< icl64f > &dstRange)
 Normalize the channel from a given min/max range to the new range. More...
 
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. More...
 
void normalizeImg (const utils::Range< icl64f > &dstRange)
 Normalize the image from a min/max range to the new range. More...
 

utility functions

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

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

◆ ~ImgBase()

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

Destructor.

◆ ImgBase()

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

Creates an ImgBase object with specified image parameters.

Member Function Documentation

◆ as16s() [1/2]

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

convenience shortcut version for asImg<icl16s>()

◆ as16s() [2/2]

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

convenience shortcut version for asImg<icl16s>()

◆ as32f() [1/2]

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

convenience shortcut version for asImg<icl32f>()

◆ as32f() [2/2]

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

convenience shortcut version for asImg<icl32f>()

◆ as32s() [1/2]

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

convenience shortcut version for asImg<icl32s>()

◆ as32s() [2/2]

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

convenience shortcut version for asImg<icl32s>()

◆ as64f() [1/2]

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

convenience shortcut version for asImg<icl64f>()

◆ as64f() [2/2]

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

convenience shortcut version for asImg<icl64f>()

◆ as8u() [1/2]

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

convenience shortcut version for asImg<icl8u>()

◆ as8u() [2/2]

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

convenience shortcut version for asImg<icl8u>()

◆ asImg() [1/2]

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

◆ asImg() [2/2]

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

◆ clear()

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

◆ clearMetaData()

void icl::core::ImgBase::clearMetaData ( )
inline

removes all meta data

◆ convert() [1/3]

template<class T >
ICLCore_API 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

◆ convert() [2/3]

ImgBase* icl::core::ImgBase::convert ( depth  d) const

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

◆ convert() [3/3]

ImgBase* icl::core::ImgBase::convert ( ImgBase poDst) const

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

◆ convertROI() [1/3]

template<class T >
ICLCore_API 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

◆ convertROI() [2/3]

ImgBase* icl::core::ImgBase::convertROI ( depth  d) 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
dnew images depth
Returns
converted image, containing the source images ROI

◆ convertROI() [3/3]

ImgBase* icl::core::ImgBase::convertROI ( ImgBase poDst) const

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

◆ deepCopy()

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 >.

◆ deepCopyROI()

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 >.

◆ detach()

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 >.

◆ fillBorder() [1/4]

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 >.

◆ fillBorder() [2/4]

virtual void icl::core::ImgBase::fillBorder ( icl64f  val,
bool  setFullROI = true 
)
pure virtual

◆ fillBorder() [3/4]

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 >.

◆ fillBorder() [4/4]

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 >.

◆ getChannels()

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

returns the channel count of the image

◆ getDataPtr() [1/2]

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 >.

◆ getDataPtr() [2/2]

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 >.

◆ getDepth()

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

returns the depth (depth8u or depth32f)

◆ getDim()

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

returns the pixel count of each channel

◆ getFormat()

format icl::core::ImgBase::getFormat ( ) const
inline

returns the current (color)-format of this image

◆ getHeight()

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

returns the images height

◆ getImageRect()

utils::Rect icl::core::ImgBase::getImageRect ( ) const
inline

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

◆ getLineStep()

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 >.

◆ getMax() [1/2]

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

◆ getMax() [2/2]

icl64f icl::core::ImgBase::getMax ( ) const

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

◆ getMetaData() [1/2]

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

returns associated meta data

◆ getMetaData() [2/2]

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

returns associated meta data (unconst)

◆ getMin() [1/2]

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

◆ getMin() [2/2]

icl64f icl::core::ImgBase::getMin ( ) const

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

◆ getMinMax() [1/2]

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

◆ getMinMax() [2/2]

const utils::Range<icl64f> icl::core::ImgBase::getMinMax ( ) const

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

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

◆ getParams()

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());

◆ getROI() [1/2]

const utils::Rect& icl::core::ImgBase::getROI ( ) const
inline

returns the images ROI rectangle

◆ getROI() [2/2]

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

copies the current ROI into the given offset and size references

◆ getROIHeight()

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

returns the images ROI height

◆ getROIOffset()

utils::Point icl::core::ImgBase::getROIOffset ( ) const
inline

returns the images ROI offset (upper left corner)

◆ getROISize()

utils::Size icl::core::ImgBase::getROISize ( ) const
inline

returns the images ROI size

◆ getROIWidth()

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

returns the images ROI width

◆ getROIXOffset()

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

returns the images ROI XOffset

◆ getROIYOffset()

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

returns the images ROI YOffset

◆ getSize()

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

returns the size of the images

◆ getTime()

utils::Time icl::core::ImgBase::getTime ( ) const
inline

returns the timestamp of the image

◆ getWidth()

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

returns the images width

◆ hasFullROI()

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

returns ROISize == ImageSize

◆ hasMetaData()

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

returns whether meta data has been associated to this image

◆ isEqual() [1/4]

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

◆ isEqual() [2/4]

bool icl::core::ImgBase::isEqual ( const ImgParams params)
inline

checks if the image has the given parameters

◆ isEqual() [3/4]

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

checks if the image has given params and depth

◆ isEqual() [4/4]

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

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

◆ isIndependent()

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 >.

◆ mirror()

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 >.

◆ normalizeAllChannels()

void icl::core::ImgBase::normalizeAllChannels ( const utils::Range< icl64f > &  dstRange)

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

◆ normalizeChannel() [1/2]

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

◆ normalizeChannel() [2/2]

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

◆ normalizeImg() [1/2]

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

◆ normalizeImg() [2/2]

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

◆ print()

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.

◆ reinterpretChannels() [1/2]

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

◆ reinterpretChannels() [2/2]

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

◆ removeChannel()

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 >.

◆ scale()

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 >.

◆ scaledCopy() [1/2]

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 >.

◆ scaledCopy() [2/2]

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 >.

◆ scaledCopyROI() [1/2]

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 >.

◆ scaledCopyROI() [2/2]

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 >.

◆ selectChannel() [1/2]

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

◆ selectChannel() [2/2]

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

◆ selectChannels() [1/2]

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

◆ selectChannels() [2/2]

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

◆ setChannels()

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 >.

◆ setFormat()

void icl::core::ImgBase::setFormat ( format  fmt)

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

◆ setFullROI()

void icl::core::ImgBase::setFullROI ( )
inline

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

◆ setMetaData()

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

associates new meta data with this image

◆ setParams()

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

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

◆ setROI() [1/2]

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

set both image ROI offset and size

◆ setROI() [2/2]

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

sets the image ROI to the given rectangle

◆ setROIAdaptive()

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

checks, eventually adapts and finally sets the image ROI size

See also
ImgParams

◆ setROIOffset()

void icl::core::ImgBase::setROIOffset ( const utils::Point offset)
inline

sets the image ROI offset to the given value

◆ setROIOffsetAdaptive()

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

checks, eventually adapts and finally sets the image ROI size

See also
ImgParams

◆ setROISize()

void icl::core::ImgBase::setROISize ( const utils::Size size)
inline

sets the image ROI size to the given value

◆ setROISizeAdaptive()

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

checks, eventually adapts and finally sets the image ROI size

See also
ImgParams

◆ setSize()

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 >.

◆ setTime() [1/2]

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

sets the timestamp of the image

◆ setTime() [2/2]

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

sets timestamp of the image to the current time

◆ shallowCopy() [1/5]

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 >.

◆ shallowCopy() [2/5]

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

◆ shallowCopy() [3/5]

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

◆ shallowCopy() [4/5]

ImgBase* icl::core::ImgBase::shallowCopy ( ImgBase **  ppoDst = NULL)
inline

◆ shallowCopy() [5/5]

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

◆ swapChannels()

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 >.

◆ validChannel()

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

validate the given channel index

Member Data Documentation

◆ m_eDepth

depth icl::core::ImgBase::m_eDepth
protected

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

◆ m_metaData

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

additional information associated with this image

◆ m_oParams

ImgParams icl::core::ImgBase::m_oParams
protected

all image params

the params class consists of

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

◆ m_timestamp

utils::Time icl::core::ImgBase::m_timestamp
protected

timestamp of the image


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