Image Component Library (ICL)
Public Member Functions | Static Public Attributes | Private Member Functions | Friends | List of all members
icl::core::Img< Type > Class Template Reference

The Img class implements the ImgBase Image interface with type specific functionalities . More...

#include <Img.h>

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

Public Member Functions

 Img (const ImgParams &params=ImgParams::null)
 creates a new image specified by the given param struct More...
 
 Img (const utils::Size &size, int channels)
 Creates an image with specified number of channels and size. More...
 
 Img (const utils::Size &s, format fmt)
 Creates an image with specified size, number of channels and format. More...
 
 Img (const utils::Size &s, int channels, format fmt)
 Crates an image with given size, channel count and format. More...
 
 Img (const utils::Size &size, format format, const std::vector< Type * > &vptData, bool passOwnerShip=false)
 Creates an image with specified size and format, using shared data pointers as channel data. More...
 
 Img (const utils::Size &size, int channels, const std::vector< Type * > &vptData, bool passOwnerShip=false)
 Creates an image with specified size and channel count, using shared data pointers as channel data. More...
 
 Img (const utils::Size &size, int channels, format fmt, const std::vector< Type * > &vptData, bool passOwnerShip=false)
 Crates an image with given size, channel count and format. More...
 
 Img (const Img< Type > &tSrc)
 Copy constructor WARNING: Violates const concept. More...
 
 Img (const math::DynMatrix< Type > &c1, const math::DynMatrix< Type > &c2=math::DynMatrix< Type >(), const math::DynMatrix< Type > &c3=math::DynMatrix< Type >(), const math::DynMatrix< Type > &c4=math::DynMatrix< Type >(), const math::DynMatrix< Type > &c5=math::DynMatrix< Type >())
 This constructor provides tight integration with DynMatrix template class. More...
 
 ~Img ()
 Destructor. More...
 
bool isNull () const
 null check : null images have 0-Channels and null-size More...
 
- Public Member Functions inherited from icl::core::ImgBase
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
void setParams (const ImgParams &params)
 sets all image parameters in order channels,size,format,roi 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...
 
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...
 
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...
 
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...
 

Static Public Attributes

static const Img< Type > null
 null sized and null channel image More...
 

Private Member Functions

Img< Type > & shallowCopy (const Img< Type > &tSource)
 Private assign operator (internally used) More...
 
void append (const Img< Type > *src, int iChannel=-1)
 private append function for a specified image channel More...
 
void append (const Img< Type > *src, const std::vector< int > &vChannels)
 private append function for a specified image channel More...
 

Friends

template<class ImgType >
const ImgType * combineImages (const std::vector< const ImgType * > &vec, ImgBase **ppoDst)
 

data

std::vector< utils::SmartArray< Type > > m_vecChannels
 internally used storage for the image channels More...
 

auxiliary functions

utils::SmartArray< Type > createChannel (Type *ptDataToCopy=0) const
 Internally creates a new deep copy of a specified Type*. More...
 
int getStartIndex (int iIndex) const
 returns the start index for a channel loop More...
 
int getEndIndex (int iIndex) const
 returns the end index for a channel loop More...
 

basic image manipulation

void normalize (int iChannel, const utils::Range< Type > &srcRange, const utils::Range< Type > &dstRange)
 Scales pixel values from given min/max values to new min/max values (for internal use) More...
 
void mirror (axis eAxis, int iChannel, const utils::Point &oOffset, const utils::Size &oSize)
 in-place mirror operation on the given image rect (for internal use) More...
 

operators

 operator Img< Type > & ()
 implicit cast to it's own reference (?) More...
 
 operator const Img< Type > & () const
 implicit cast to it's own reference (?) (const) More...
 
Img< Type > & operator= (const Img< Type > &tSource)
 Assign operator (flat copy of channels) WARNING: Violates const concept. More...
 
Type & operator() (int iX, int iY, int iChannel)
 pixel access operator More...
 
const Type & operator() (int iX, int iY, int iChannel) const
 as above, but const More...
 
PixelRef< Type > operator() (int x, int y)
 extracts a pixels channel values at once More...
 
const PixelRef< Type > operator() (int x, int y) const
 as above, but const More...
 
Channel< Type > operator[] (int channel)
 extracts an image channel More...
 
const Channel< Type > operator[] (int channel) const
 extracts an image channel More...
 
float subPixelNN (float fX, float fY, int iChannel) const
 sub-pixel access using nearest neighbor interpolation More...
 
float subPixelLIN (float fX, float fY, int iChannel) const
 sub-pixel access using linear interpolation More...
 
float subPixelRA (float fX, float fY, float w, float h, int iChannel) const
 sub-pixel access using region average interpolation More...
 
float subPixelRA (const unsigned int xB, const unsigned int xE, const unsigned int yB, const unsigned int yE, const float xBMul, const float xEMul, const float BMul, const float yEMul, const Type *d, const unsigned int w) const
 
Type operator() (float fX, float fY, int iChannel, scalemode eMode) const
 sub-pixel access operator, uses given interpolation method More...
 

extractChannel functions

math::DynMatrix< Type > extractDynMatrix (int channel)
 extracts given channel as DynMatrix<Type> More...
 
const math::DynMatrix< Type > extractDynMatrix (int channel) const
 extracts given channel as DynMatrix<Type> const More...
 
void extractChannels (Channel< Type > *dst)
 extracts all image channels at once into given channel pointer More...
 
void extractChannels (Channel< Type > *dst) const
 this function is forbidden, it produces an error message More...
 
void extractChannels (const Channel< Type > *dst) const
 extracts all image channels at once into given channel pointer (const) More...
 
void extractPointers (Type **dst)
 extracts all data pointers into given destination pointer More...
 
void extractPointers (Type **dst) const
 this function is forbidden, it produces an error message More...
 
void extractPointers (const Type **dst) const
 extracts all data pointers into given destination pointer (const) More...
 

shallow/deepCopy functions

virtual Img< Type > * shallowCopy (const utils::Rect &roi, const std::vector< int > &channelIndices, format fmt, utils::Time time=utils::Time::null, ImgBase **ppoDst=NULL)
 
const Img< Type > * shallowCopy (const utils::Rect &roi, const std::vector< int > &channelIndices, format fmt, utils::Time time=utils::Time::null) const
 
Img< Type > * reinterpretChannels (format newFmt, Img< Type > *poDst=NULL)
 Create a shallow copy of this image with a new format. More...
 
const Img< Type > * reinterpretChannels (format newFmt)
 Create a shallow copy of this image with a new format (const version) More...
 
Img< Type > * shallowCopy (const utils::Rect &roi, Img< Type > *poDst=NULL)
 Create a shallow copy of the image. More...
 
const Img< Type > * shallowCopy (const utils::Rect &roi) const
 Create a shallow copy of a const source image. More...
 
Img< Type > * selectChannels (const std::vector< int > &channelIndices, Img< Type > *poDst=0)
 Create a shallow copy of selected channels of an image. More...
 
Img< Type > * selectChannel (int channelIndex, Img< Type > *poDst=0)
 Create a shallow copy of a single image channel of an image. More...
 
const Img< Type > * selectChannels (const std::vector< int > &channelIndices) const
 Create a shallow copy of selected channels of a const image. More...
 
const Img< Type > * selectChannel (int channelIndex) const
 Create a shallow copy of a single image channel of a const image. More...
 
virtual Img< Type > * deepCopy (ImgBase **ppoDst=0) const
 Perform a deep copy of an image. More...
 
Img< Type > * deepCopy (Img< Type > *poDst) const
 Perform a deep copy of an image. More...
 
virtual Img< Type > * deepCopyROI (ImgBase **ppoDst=0) const
 Perform a deep copy of an images ROI. More...
 
Img< Type > * deepCopyROI (Img< Type > *poDst) const
 Perform a deep copy of an images ROI. More...
 
virtual Img< Type > * scaledCopy (const utils::Size &newSize, scalemode eScaleMode=interpolateNN) const
 create a scaled copy of this image More...
 
virtual Img< Type > * scaledCopy (ImgBase **ppoDst=0, scalemode eScaleMode=interpolateNN) const
 create a scaled copy of this image More...
 
Img< Type > * scaledCopy (Img< Type > *poDst, scalemode eScaleMode=interpolateNN) const
 create a scaled copy of this image More...
 
virtual Img< Type > * scaledCopyROI (const utils::Size &newSize, scalemode eScaleMode=interpolateNN) const
 create a scaled copy of an images ROI with given size More...
 
virtual Img< Type > * scaledCopyROI (ImgBase **ppoDst=0, scalemode eScaleMode=interpolateNN) const
 create a scaled copy of an images ROI with given destination image More...
 
Img< Type > * scaledCopyROI (Img< Type > *poDst, scalemode eScaleMode=interpolateNN) const
 create a scaled copy of this images ROI More...
 

organization and channel management

virtual void detach (int iIndex=-1)
 Makes the image channels inside the Img independent from other Img. More...
 
Img< Type > detached () const
 Utility method, that returns a detached version of this image. More...
 
virtual void removeChannel (int iChannel)
 Removes a specified channel. More...
 
void append (Img< Type > *src, int iChannel=-1)
 Append channels of external Img to the existing Img. More...
 
void append (Img< Type > *src, const std::vector< int > &vChannels)
 Append a set of selected channels from source image. More...
 
Img< Type > extractChannelImg (int index)
 Returns a new image with a shallow copied single channel of this image. More...
 
const Img< Type > extractChannelImg (int index) const
 Returns a new image with a shallow copied single channel of this image. More...
 
Img< Type > extractChannelImg (const std::vector< int > &indices)
 Returns a new image with shallow copied single channels of this image. More...
 
const Img< Type > extractChannelImg (const std::vector< int > &indices) const
 Returns a new image with shallow copied single channels of this image. More...
 
virtual void swapChannels (int iIndexA, int iIndexB)
 Swap channel A and B. More...
 
void replaceChannel (int iThisIndex, Img< Type > *poOtherImg, int iOtherIndex)
 Replace the channel A of this image with the channel B another image. More...
 
virtual void setChannels (int iNewNumChannels)
 sets the channel count to a new value More...
 
virtual void setSize (const utils::Size &s)
 resizes the image to new values More...
 

getter functions

Type getMax (int iChannel, utils::Point *coords=0) const
 Returns max pixel value of channel iChannel within ROI. More...
 
Type getMin (int iChannel, utils::Point *coords=0) const
 Returns min pixel value of channel iChannel within ROI. More...
 
Type getMin () const
 return maximal pixel value over all channels (restricted to ROI) More...
 
Type getMax () const
 return minimal pixel value over all channels (restricted to ROI) More...
 
const utils::Range< Type > getMinMax (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< Type > getMinMax () const
 return minimal and maximal pixel values over all channels (restricted to ROI) More...
 
virtual int getLineStep () const
 Returns the width of an image line in bytes. More...
 
Type * getData (int iChannel)
 returns a Type save data data pointer to the channel data origin More...
 
const Type * getData (int iChannel) const
 returns a Type save data data pointer to the channel data origin (const) More...
 
Type * getROIData (int iChannel)
 returns a Type save data pointer to the first pixel within the images roi More...
 
const Type * getROIData (int iChannel) const
 returns a Type save data pointer to the first pixel within the images roi (const) More...
 
Type * getROIData (int iChannel, const utils::Point &p)
 returns the data pointer to a pixel with defined offset More...
 
const Type * getROIData (int iChannel, const utils::Point &p) const
 returns the data pointer to a pixel with defined offset (const) More...
 
virtual void * getDataPtr (int iChannel)
 returns the raw- data pointer of an image channel More...
 
virtual const void * getDataPtr (int iChannel) const
 returns the raw- data pointer of an image channel (const) More...
 

basic in-place image manipulations

template<typename UnaryFunction >
Img< Type > & forEach_C (UnaryFunction f, int channel)
 STL based "for_each" implementations applying an Unary function on each ROI-pixel of given channel. More...
 
template<typename UnaryFunction >
Img< Type > & forEach (UnaryFunction f)
 STL based "for_each" implementations applying an Unary function on each ROI-pixel. More...
 
template<typename UnaryFunction , class dstType >
Img< dstType > & transform_C (UnaryFunction f, int srcChannel, int dstChannel, Img< dstType > &dst) const
 STL based "transform" implementation applying an Unary function on ROI-pixles with given destination image. More...
 
template<typename UnaryFunction , class dstType >
Img< dstType > & transform (UnaryFunction f, Img< dstType > &dst) const
 STL based "transform" implementation applying an Unary function on ROI-pixles with given destination image. More...
 
template<typename BinaryFunction , class dstType , class otherSrcType >
Img< dstType > & combine_C (BinaryFunction f, int thisChannel, int otherSrcChannel, int dstChannel, const Img< otherSrcType > &otherSrc, Img< dstType > &dst) const
 STL-based "transform function combining two images pixel-wise into a given destination image (with ROI support)". More...
 
template<typename BinaryFunction , class dstType , class otherSrcType >
Img< dstType > & combine (BinaryFunction f, const Img< otherSrcType > &otherSrc, Img< dstType > &dst) const
 STL-based "transform function combining two images pixel-wise into a given destination image (with ROI support)". More...
 
template<typename Tdst , int Nthis, int Ndst, typename ReduceFunc >
void reduce_channels (Img< Tdst > &dst, ReduceFunc reduce) const
 Utility function for combining image channels into another image. More...
 
Img< Type > * lut (const Type *lut, Img< Type > *dst=0, int bits=8) const
 applys a lookup function using the given lookup table More...
 
virtual void scale (const utils::Size &s, scalemode eScaleMode=interpolateNN)
 perform an in-place resize of the image (keeping the data) More...
 
virtual void mirror (axis eAxis, bool bOnlyROI=false)
 perform an in-place mirror operation on the image More...
 
void clear (int iChannel=-1, Type tValue=0, bool bROIOnly=true)
 Sets the ROI pixels of one or all channels to a specified value. More...
 
template<class T >
void fill (const T &value)
 fills the whole image with given source type value More...
 
template<class T >
void fillChannel (int channel, const T &value)
 fills the given channel with given source type value More...
 
template<class T >
void fillROI (const T &value)
 fills the whole image with given source type value More...
 
template<class T >
void fillChannelROI (int channel, const T &value)
 fills the given channel's with given source type value More...
 
void normalizeAllChannels (const utils::Range< Type > &dstRange)
 Normalize the channel min/ max range to the new min, max range. More...
 
void normalizeChannel (int iChannel, const utils::Range< Type > &srcRange, const utils::Range< Type > &dstRange)
 Normalize the channel from a given min/max range to the new range. More...
 
void normalizeChannel (int iChannel, const utils::Range< Type > &dstRange)
 Normalize the channel from a given min/max range to the new range. More...
 
void normalizeImg (const utils::Range< Type > &srcRange, const utils::Range< Type > &dstRange)
 Normalize the image from a given min/max range to the new range. More...
 
void normalizeImg (const utils::Range< Type > &dstRange)
 Normalize the image from a min/max range to the new range. More...
 
template<typename Tsrc , typename Tdst , int Nsrc, int Ndst, typename ReduceFunc >
static void reduce_arrays (const Tsrc *src[Nsrc], Tdst *dst[Ndst], unsigned int dim, ReduceFunc reduce)
 private helper function called from reduce_channels template More...
 

pixel access using roi iterator

typedef Type * iterator
 iterator type (just a data pointer) More...
 
typedef const Type * const_iterator
 const iterator type (just a const pointer) More...
 
typedef ImgIterator< Type > roi_iterator
 type definition for ROI iterator More...
 
typedef const ImgIterator< Type > const_roi_iterator
 type definition for a const ROI iterator More...
 
iterator begin (int channel)
 returns the image iterator (equal to getData(channel)) More...
 
const_iterator begin (int channel) const
 returns the image iterator (equal to getData(channel)) (const) More...
 
iterator end (int channel)
 returns the image end-iterator (equal to getData(channel)+getDim()) More...
 
const_iterator end (int channel) const
 returns the image end-iterator (const) More...
 
roi_iterator beginROI (int channel)
 returns the iterator for an images ROI More...
 
const_roi_iterator beginROI (int channel) const
 returns the iterator for an images ROI (const) More...
 
roi_iterator endROI (int channel)
 returns the end-iterator for an images ROI More...
 
const_roi_iterator endROI (int channel) const
 returns the end-iterator for an images ROI (const) More...
 
utils::Point getLocation (const Type *p, int channel, bool relToROI=false) const
 returns the x,y-coordinates of a pointer whithin a given channel More...
 
void printAsMatrix (const std::string &format="5.3", bool visROI=true) const
 shows the image value by value at std::out More...
 
virtual bool isIndependent () const
 shows wheter all image channels are currently not share with another image More...
 

border functions

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

Additional Inherited Members

- Protected Member Functions inherited from icl::core::ImgBase
 ImgBase (depth d, const ImgParams &params)
 Creates an ImgBase object with specified image parameters. More...
 
- Protected Attributes inherited from icl::core::ImgBase
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...
 

Detailed Description

template<class Type>
class icl::core::Img< Type >

The Img class implements the ImgBase Image interface with type specific functionalities .

forward declaration of the Img-class

Member Typedef Documentation

◆ const_iterator

template<class Type>
typedef const Type* icl::core::Img< Type >::const_iterator

const iterator type (just a const pointer)

◆ const_roi_iterator

template<class Type>
typedef const ImgIterator<Type> icl::core::Img< Type >::const_roi_iterator

type definition for a const ROI iterator

◆ iterator

template<class Type>
typedef Type* icl::core::Img< Type >::iterator

iterator type (just a data pointer)

◆ roi_iterator

template<class Type>
typedef ImgIterator<Type> icl::core::Img< Type >::roi_iterator

type definition for ROI iterator

Constructor & Destructor Documentation

◆ Img() [1/9]

template<class Type>
icl::core::Img< Type >::Img ( const ImgParams params = ImgParams::null)

creates a new image specified by the given param struct

Parameters
paramsinitializing image parameters, if null, then a null image is created

◆ Img() [2/9]

template<class Type>
icl::core::Img< Type >::Img ( const utils::Size size,
int  channels 
)

Creates an image with specified number of channels and size.

the format of the image will be set to "formatMatrix"

Parameters
sizeimage size
channelsNumber of Channels

◆ Img() [3/9]

template<class Type>
icl::core::Img< Type >::Img ( const utils::Size s,
format  fmt 
)

Creates an image with specified size, number of channels and format.

Parameters
ssize of the new image
fmt(color)-format of the image

◆ Img() [4/9]

template<class Type>
icl::core::Img< Type >::Img ( const utils::Size s,
int  channels,
format  fmt 
)

Crates an image with given size, channel count and format.

Note: channel count and format depend on each other, so if the given channel count and the given format are not compatible, an exception is thrown

Parameters
ssize of the image
channelschannel count of the image (must be compatible to fmt)
fmtformat of the image (must be compatible to channels)

◆ Img() [5/9]

template<class Type>
icl::core::Img< Type >::Img ( const utils::Size size,
format  format,
const std::vector< Type * > &  vptData,
bool  passOwnerShip = false 
)

Creates an image with specified size and format, using shared data pointers as channel data.

The channel count is set to the channel count that is associated with given the format

Parameters
sizenew image size
format(color)-format of the image
vptDataholds channel data pointers. It must contain enough Type-pointers for the given format. The data must not be deleted during the "lifetime" of the Img unless data ownership is passed to the Img instance by setting passOwnerShip to true. Call detach after the constructor call, to induce the Img to allocate own memory for the image data if ownership cannot be passed.
passOwnerShipflag to specify the passed ownership

◆ Img() [6/9]

template<class Type>
icl::core::Img< Type >::Img ( const utils::Size size,
int  channels,
const std::vector< Type * > &  vptData,
bool  passOwnerShip = false 
)

Creates an image with specified size and channel count, using shared data pointers as channel data.

the format is set to formatMatrix

Parameters
sizenew image size
channelschannel count of the image (format is set to "formatMatrix")
vptDataholds channel data pointers. It must contain at least 'channels' data pointers. The data must not be deleted during the "lifetime" of the Img unless data ownership is passed to the Img instance by setting passOwnerShip to true. Call detach after the constructor call, to induce the Img to allocate own memory for the image data if ownership cannot be passed.
passOwnerShipflag to specify the passed ownership

◆ Img() [7/9]

template<class Type>
icl::core::Img< Type >::Img ( const utils::Size size,
int  channels,
format  fmt,
const std::vector< Type * > &  vptData,
bool  passOwnerShip = false 
)

Crates an image with given size, channel count and format.

Note: channel count and format depend on each other, so if the given channel count and the given format are not compatible, an exception is thrown

Parameters
sizesize of the image
channelschannel count of the image (must be compatible to fmt)
fmtformat of the image (must be compatible to channels)
vptDataarray of data pointers, which are used as shared pointers. Ensure, that these pointers are persistent during the lifetime of the image unless ownership is passed by setting passOwnerShip to true, or call detach, to make the image allocate it own memory for the data
passOwnerShipflag to specify the passed ownership

◆ Img() [8/9]

template<class Type>
icl::core::Img< Type >::Img ( const Img< Type > &  tSrc)

Copy constructor WARNING: Violates const concept.

Creates a flat copy of the source image. The new image will contain a flat copy of all channels of the source image. This constructor is only applicable to non-const Img<Type> references. Note: this implicit shallow copy can be exploited to violate ICL's const concept:

void func(const Img8u &a){
Img8u b = a;
// b is now unconst and therewith the data of
// a can b chaned
}
Parameters
tSrcnon-const reference of source instance

◆ Img() [9/9]

template<class Type>
icl::core::Img< Type >::Img ( const math::DynMatrix< Type > &  c1,
const math::DynMatrix< Type > &  c2 = math::DynMatrix< Type >(),
const math::DynMatrix< Type > &  c3 = math::DynMatrix< Type >(),
const math::DynMatrix< Type > &  c4 = math::DynMatrix< Type >(),
const math::DynMatrix< Type > &  c5 = math::DynMatrix< Type >() 
)

This constructor provides tight integration with DynMatrix template class.

creates a shallow Img<Type>-wrapper around a set of DynMatrix instances. Note, of course this consturctor might be used to break DynMatrix's const concept, so please be aware of this!. The resulting image counts that many channels as given count (up to 5) of non-null DynMatrix<T> instances. All null instances must have the same size, otherwise, an exception of type InvalidMatrixDimensionException is thrown.

Parameters
c1first image channel (mandatory) (if this is null, the image becomes null)
c2optional 2nd image channel. Must have the same size as c1.
c3optional 3rd image channel. Must have the same size as c1 and c2.
c4optional 4th image channel. Must have the same size as c1 - c3.
c5optional 5th image channel. Must have the same size as c1 - c4.

◆ ~Img()

template<class Type>
icl::core::Img< Type >::~Img ( )

Destructor.

Member Function Documentation

◆ append() [1/4]

template<class Type>
void icl::core::Img< Type >::append ( const Img< Type > *  src,
int  iChannel = -1 
)
private

private append function for a specified image channel

This must be kept private! Because it could otherwise be exploited to violate the Img's const concept

◆ append() [2/4]

template<class Type>
void icl::core::Img< Type >::append ( const Img< Type > *  src,
const std::vector< int > &  vChannels 
)
private

private append function for a specified image channel

This must be kept private! Because it could otherwise be exploited to violate the Img's const concept

◆ append() [3/4]

template<class Type>
void icl::core::Img< Type >::append ( Img< Type > *  src,
int  iChannel = -1 
)
inline

Append channels of external Img to the existing Img.

Both objects will share their data (cheap copy). If a non-matrix format image gets new channels using it's append method, the new channel count will not match to the channel count, that is associated with the current format. In this case, a waring is written to std::out, and the format will be set to formatMatrix implicitly.

Parameters
srcsource image
iChannelchannel to append (or all, if < 0)

◆ append() [4/4]

template<class Type>
void icl::core::Img< Type >::append ( Img< Type > *  src,
const std::vector< int > &  vChannels 
)
inline

Append a set of selected channels from source image.

Parameters
srcsource image
vChannelsvector of channels indices

◆ begin() [1/2]

template<class Type>
iterator icl::core::Img< Type >::begin ( int  channel)
inline

returns the image iterator (equal to getData(channel))

◆ begin() [2/2]

template<class Type>
const_iterator icl::core::Img< Type >::begin ( int  channel) const
inline

returns the image iterator (equal to getData(channel)) (const)

◆ beginROI() [1/2]

template<class Type>
roi_iterator icl::core::Img< Type >::beginROI ( int  channel)
inline

returns the iterator for an images ROI

◆ beginROI() [2/2]

template<class Type>
const_roi_iterator icl::core::Img< Type >::beginROI ( int  channel) const
inline

returns the iterator for an images ROI (const)

◆ clear()

template<class Type>
void icl::core::Img< Type >::clear ( int  iChannel = -1,
Type  tValue = 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)
tValuedestination value (default: 0)
bROIOnlyif set false, the whole image is set to tValue

◆ combine()

template<class Type>
template<typename BinaryFunction , class dstType , class otherSrcType >
Img<dstType>& icl::core::Img< Type >::combine ( BinaryFunction  f,
const Img< otherSrcType > &  otherSrc,
Img< dstType > &  dst 
) const
inline

STL-based "transform function combining two images pixel-wise into a given destination image (with ROI support)".

This function calls D = F(A,B), with D: destination ROI pixel, F: given binary functor/function, A: pixel of this image and B: pixel of other given src image. Internally this function uses std::transform Beispiel:

#include <ICLQt/Quick.h>
int main(){
ImgQ a = scale(create("parrot"),640,480);
ImgQ b = scale(create("women"),640,480);
Img8u dst(a.getParams());
a.setROI(Rect(10,10,300,100));
b.setROI(Rect(10,10,300,100));
dst.setROI(Rect(10,10,300,100));
a.combine(std::less<icl32f>(),b,dst);
dst.setFullROI();
show(norm(cvt(dst)));
return 0;
}
Parameters
fbinary function or functor implementing "dstType operator() const(Type &a, otherSrcType &b) const"
otherSrc2nd source image
dstdestination image

◆ combine_C()

template<class Type>
template<typename BinaryFunction , class dstType , class otherSrcType >
Img<dstType>& icl::core::Img< Type >::combine_C ( BinaryFunction  f,
int  thisChannel,
int  otherSrcChannel,
int  dstChannel,
const Img< otherSrcType > &  otherSrc,
Img< dstType > &  dst 
) const
inline

STL-based "transform function combining two images pixel-wise into a given destination image (with ROI support)".

Internally this function uses std::transform. Example:

#include <ICLQt/Quick.h>
inline bool gt_func(const float &a,const float &b){
return a > b;
}
struct EqFunctor{
bool operator()(const float &a, const float &b){
return a == b;
}
};
int main(){
ImgQ a = scale(create("parrot"),640,480);
ImgQ b = scale(create("women"),640,480);
Img8u dst(a.getParams());
a.setROI(Rect(10,10,500,400));
b.setROI(Rect(10,10,500,400));
dst.setROI(Rect(10,10,500,400));
a.combine_C(std::less<icl32f>(),0,0,0,b,dst);
a.combine_C(gt_func,1,1,1,b,dst);
a.combine_C(EqFunctor(),2,2,2,b,dst);
dst.setFullROI();
show(norm(cvt(dst)));
return 0;
}
Parameters
fbinary function of functor implementing "dstType operator() const(Type &a, otherSrcType &b) const"
thisChannelvalid channel of this image
otherSrcChannelvalid channel index for give 2nd source image
dstChannelvalid channel index of dst image
otherSrc2nd source image (ROI-size must be equal to this' ROI size)
dstdestination image (ROI-size must be equal to this' ROI size)

◆ createChannel()

template<class Type>
utils::SmartArray<Type> icl::core::Img< Type >::createChannel ( Type *  ptDataToCopy = 0) const
protected

Internally creates a new deep copy of a specified Type*.

if the give Type* ptDataToCopy is not NULL, the data addressed from it, is copied deeply into the new created data pointer

◆ deepCopy() [1/2]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::deepCopy ( ImgBase **  ppoDst = 0) const
virtual

Perform a deep copy of an image.

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

Implements icl::core::ImgBase.

◆ deepCopy() [2/2]

template<class Type>
Img<Type>* icl::core::Img< Type >::deepCopy ( Img< Type > *  poDst) const

Perform a deep copy of an image.

This is an overloaded version of the above function. It behaves essentially like the above function, except getting an Img<Type>* as destination image argument, what allows to apply the operation without a depth switch.

Parameters
poDstdestination image, if NULL, a new Img<Type> is created
Returns
deep copy of this image

◆ deepCopyROI() [1/2]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::deepCopyROI ( ImgBase **  ppoDst = 0) const
virtual

Perform a deep copy of an images ROI.

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

Implements icl::core::ImgBase.

◆ deepCopyROI() [2/2]

template<class Type>
Img<Type>* icl::core::Img< Type >::deepCopyROI ( Img< Type > *  poDst) const

Perform a deep copy of an images ROI.

This is an overloaded version of the above function. It behaves essentially like the above function, except getting an Img<Type>* as destination image argument, what allows to apply the operation without a depth switch.

Parameters
poDstdestination image, if NULL, a new Img<Type> is created. poDst must have either ROI size identical to this images ROI size or zero-dim size (in this case poDst's size is set to this images ROI size)
Returns
deep copy of this images ROI

◆ detach()

template<class Type>
virtual void icl::core::Img< Type >::detach ( int  iIndex = -1)
virtual

Makes the image channels inside the Img independent from other Img.

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

Implements icl::core::ImgBase.

◆ detached()

template<class Type>
Img<Type> icl::core::Img< Type >::detached ( ) const
inline

Utility method, that returns a detached version of this image.

This method can be seen as a deep-copy method. With this method, you can copy an image deeply be calling

Img8u deeplyCopiedInstance = sourceImage.detached();

◆ end() [1/2]

template<class Type>
iterator icl::core::Img< Type >::end ( int  channel)
inline

returns the image end-iterator (equal to getData(channel)+getDim())

◆ end() [2/2]

template<class Type>
const_iterator icl::core::Img< Type >::end ( int  channel) const
inline

returns the image end-iterator (const)

◆ endROI() [1/2]

template<class Type>
roi_iterator icl::core::Img< Type >::endROI ( int  channel)
inline

returns the end-iterator for an images ROI

the returned iterator must not be incremented or decremented!

◆ endROI() [2/2]

template<class Type>
const_roi_iterator icl::core::Img< Type >::endROI ( int  channel) const
inline

returns the end-iterator for an images ROI (const)

◆ extractChannelImg() [1/4]

template<class Type>
Img<Type> icl::core::Img< Type >::extractChannelImg ( int  index)

Returns a new image with a shallow copied single channel of this image.

param index channel index to extract (must be valid, else resulting image has no channels and error message)

◆ extractChannelImg() [2/4]

template<class Type>
const Img<Type> icl::core::Img< Type >::extractChannelImg ( int  index) const

Returns a new image with a shallow copied single channel of this image.

param index channel index to extract (must be valid, else resulting image has no channels and error message)

◆ extractChannelImg() [3/4]

template<class Type>
Img<Type> icl::core::Img< Type >::extractChannelImg ( const std::vector< int > &  indices)

Returns a new image with shallow copied single channels of this image.

param indices channel indices to extract (each must be valid, else error and channel index that does not match is omitted)

◆ extractChannelImg() [4/4]

template<class Type>
const Img<Type> icl::core::Img< Type >::extractChannelImg ( const std::vector< int > &  indices) const

Returns a new image with shallow copied single channels of this image.

param indices channel indices to extract (each must be valid, else error and channel index that does not match is omitted)

◆ extractChannels() [1/3]

template<class Type>
void icl::core::Img< Type >::extractChannels ( Channel< Type > *  dst)
inline

extracts all image channels at once into given channel pointer

◆ extractChannels() [2/3]

template<class Type>
void icl::core::Img< Type >::extractChannels ( Channel< Type > *  dst) const
inline

this function is forbidden, it produces an error message

This would allow the programme to violate the Imgs const concept

◆ extractChannels() [3/3]

template<class Type>
void icl::core::Img< Type >::extractChannels ( const Channel< Type > *  dst) const
inline

extracts all image channels at once into given channel pointer (const)

Plese note that the given dst-pointer must also be const

◆ extractDynMatrix() [1/2]

template<class Type>
math::DynMatrix<Type> icl::core::Img< Type >::extractDynMatrix ( int  channel)
inline

extracts given channel as DynMatrix<Type>

◆ extractDynMatrix() [2/2]

template<class Type>
const math::DynMatrix<Type> icl::core::Img< Type >::extractDynMatrix ( int  channel) const
inline

extracts given channel as DynMatrix<Type> const

◆ extractPointers() [1/3]

template<class Type>
void icl::core::Img< Type >::extractPointers ( Type **  dst)
inline

extracts all data pointers into given destination pointer

◆ extractPointers() [2/3]

template<class Type>
void icl::core::Img< Type >::extractPointers ( Type **  dst) const
inline

this function is forbidden, it produces an error message

This would allow the programme to violate the Imgs const concept

◆ extractPointers() [3/3]

template<class Type>
void icl::core::Img< Type >::extractPointers ( const Type **  dst) const
inline

extracts all data pointers into given destination pointer (const)

◆ fill()

template<class Type>
template<class T >
void icl::core::Img< Type >::fill ( const T &  value)
inline

fills the whole image with given source type value

In contrast to icl::Img::clear, which is highly optimized, this methods use std::fill. By this means, the given source value is really assigned to each value. This can e.g. be used to fill an image with random values

#include <ICLCore/Img.h>
#include <ICLCore/Random.h>
#include <ICLQt/Quick.h>
void foo(){
Img8u image(Size::QQVGA,3);
image.fill(URandI(255));
show(image);
}
img-fill.jpg
result if Img::fill example

◆ fillBorder() [1/4]

template<class Type>
virtual void icl::core::Img< Type >::fillBorder ( bool  setFullROI = true)
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

Implements icl::core::ImgBase.

◆ fillBorder() [2/4]

template<class Type>
virtual void icl::core::Img< Type >::fillBorder ( icl64f  val,
bool  setFullROI = true 
)
virtual

fills all non-ROI pixels with a given value

Implements icl::core::ImgBase.

◆ fillBorder() [3/4]

template<class Type>
virtual void icl::core::Img< Type >::fillBorder ( const std::vector< icl64f > &  vals,
bool  setFullROI = true 
)
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()

Implements icl::core::ImgBase.

◆ fillBorder() [4/4]

template<class Type>
virtual void icl::core::Img< Type >::fillBorder ( const ImgBase src,
bool  setFullROI = true 
)
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.

Implements icl::core::ImgBase.

◆ fillChannel()

template<class Type>
template<class T >
void icl::core::Img< Type >::fillChannel ( int  channel,
const T &  value 
)
inline

fills the given channel with given source type value

◆ fillChannelROI()

template<class Type>
template<class T >
void icl::core::Img< Type >::fillChannelROI ( int  channel,
const T &  value 
)
inline

fills the given channel's with given source type value

◆ fillROI()

template<class Type>
template<class T >
void icl::core::Img< Type >::fillROI ( const T &  value)
inline

fills the whole image with given source type value

◆ forEach()

template<class Type>
template<typename UnaryFunction >
Img<Type>& icl::core::Img< Type >::forEach ( UnaryFunction  f)
inline

STL based "for_each" implementations applying an Unary function on each ROI-pixel.

Internally using std::for_each by calling Img<T>::forEach_C for all channels Example:

#include <ICLQt/Quick.h>
struct Thresh{
inline void operator()(float &f){ f = f>128 ? 0 : 255; }
};
int main(){
ImgQ a = scale(create("parrot"),0.2);
a.forEach(Thresh());
show(a);
return 0;
}
Parameters
funary function or functor implementing "AnyType operator()(Type &val)"

◆ forEach_C()

template<class Type>
template<typename UnaryFunction >
Img<Type>& icl::core::Img< Type >::forEach_C ( UnaryFunction  f,
int  channel 
)
inline

STL based "for_each" implementations applying an Unary function on each ROI-pixel of given channel.

Internally this function uses std::for_each Example:

#include <ICLQt/Quick.h>
struct Thresh{
inline void operator()(float &f){ f = f>128 ? 0 : 255; }
};
inline void ttt(float &f){
f = f>128 ? 0 : 255;
}
int main(){
ImgQ a = create("parrot");
a.forEach_C(ttt,1);
a.forEach_C(Thresh(),0);
show(scale(a,0.2));
return 0;
}
Parameters
funary function or functor implementing "AnyType operator()(Type &val)"
channelvalid channel index for this image

◆ getData() [1/2]

template<class Type>
Type* icl::core::Img< Type >::getData ( int  iChannel)
inline

returns a Type save data data pointer to the channel data origin

If the channel index is not valid (<0 or >= getChannels) NULL is returned and an error is written to std::err

Parameters
iChannelspecifies the channel
Returns
data origin pointer to the specified channel

◆ getData() [2/2]

template<class Type>
const Type* icl::core::Img< Type >::getData ( int  iChannel) const
inline

returns a Type save data data pointer to the channel data origin (const)

returns a Type save data data pointer to the channel data origin If the channel index is not valid (<0 or >= getChannels) NULL is returned and an error is written to std::err

Parameters
iChannelspecifies the channel
Returns
data origin pointer to the specified channel

◆ getDataPtr() [1/2]

template<class Type>
virtual void* icl::core::Img< Type >::getDataPtr ( int  iChannel)
inlinevirtual

returns the raw- data pointer of an image channel

returns a pointer to first data element of a given channel

See also
Img

Implements icl::core::ImgBase.

◆ getDataPtr() [2/2]

template<class Type>
virtual const void* icl::core::Img< Type >::getDataPtr ( int  iChannel) const
inlinevirtual

returns the raw- data pointer of an image channel (const)

returns a pointer to first data element of a given channel

See also
Img

Implements icl::core::ImgBase.

◆ getEndIndex()

template<class Type>
int icl::core::Img< Type >::getEndIndex ( int  iIndex) const
inlineprotected

returns the end index for a channel loop

this function behaves essentially like the above function

Parameters
iIndexchannel index
Returns
end index for for-loops
See also
getStartIndex

◆ getLineStep()

template<class Type>
virtual int icl::core::Img< Type >::getLineStep ( ) const
inlinevirtual

Returns the width of an image line in bytes.

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

Implements icl::core::ImgBase.

◆ getLocation()

template<class Type>
utils::Point icl::core::Img< Type >::getLocation ( const Type *  p,
int  channel,
bool  relToROI = false 
) const

returns the x,y-coordinates of a pointer whithin a given channel

E.g channel c's pointer of image I points to adress p=1005, image width is 10 and data depth is 1 (icl-8u image). Then I.getLocation(1006,c) returns Point(1,0) and I.getLocation(1015,c) returns Point(0,1).
The following rule is always true: Point p = somewhat; image i = somewhat; p == i.getLocation(i.getData(0)+p.x+image.getWidth()*p.y,any-valid-channel); Optionally, returned point can be calculated w.r.t. the images roi offset.

◆ getMax() [1/2]

template<class Type>
Type icl::core::Img< Type >::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]

template<class Type>
Type icl::core::Img< Type >::getMax ( ) const

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

◆ getMin() [1/2]

template<class Type>
Type icl::core::Img< Type >::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]

template<class Type>
Type icl::core::Img< Type >::getMin ( ) const

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

◆ getMinMax() [1/2]

template<class Type>
const utils::Range<Type> icl::core::Img< Type >::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

◆ getMinMax() [2/2]

template<class Type>
const utils::Range<Type> icl::core::Img< Type >::getMinMax ( ) const

return minimal and maximal pixel values over all channels (restricted to ROI)

◆ getROIData() [1/4]

template<class Type>
Type* icl::core::Img< Type >::getROIData ( int  iChannel)
inline

returns a Type save data pointer to the first pixel within the images roi

The following ASCII image shows an images ROI.

               1st roi-pixel
                    |
                ....|....................         ---
                ....|..ooooooooo......... ---      |
                ....|..ooooooooo.........  |       |
                ....|..ooooooooo......... roi-h  image-h
1st image pixel ....|..ooooooooo.........  |       |
     |          ....+->xoooooooo......... ---      |
     +--------->x........................         ---
                       |-roi-w-|
                |---------image-w-------|

Note: most ipp-function require the ROI-data pointer

Parameters
iChannelspecifies the channel
Returns
roi data pointer

◆ getROIData() [2/4]

template<class Type>
const Type* icl::core::Img< Type >::getROIData ( int  iChannel) const
inline

returns a Type save data pointer to the first pixel within the images roi (const)

returns a Type save data pointer to the first pixel within the images roi The following ASCII image shows an images ROI.

               1st roi-pixel
                    |
                ....|....................         ---
                ....|..ooooooooo......... ---      |
                ....|..ooooooooo.........  |       |
                ....|..ooooooooo......... roi-h  image-h
1st image pixel ....|..ooooooooo.........  |       |
     |          ....+->xoooooooo......... ---      |
     +--------->x........................         ---
                       |-roi-w-|
                |---------image-w-------|

Note: most ipp-function require the ROI-data pointer

Parameters
iChannelspecifies the channel
Returns
roi data pointer

◆ getROIData() [3/4]

template<class Type>
Type* icl::core::Img< Type >::getROIData ( int  iChannel,
const utils::Point p 
)
inline

returns the data pointer to a pixel with defined offset

In some functions like filters, it might be necessary to change the images ROI parameters before applying the underlying image operation. Temporarily changing the images ROI parameters causes problems in multi-threaded environments. To avoid this, this function provides access to a data pointer to an arbitrary notional ROI-offset

Parameters
iChannelselects the channel
pnotional ROI offset
Returns
data pointer with notional ROI offset p

◆ getROIData() [4/4]

template<class Type>
const Type* icl::core::Img< Type >::getROIData ( int  iChannel,
const utils::Point p 
) const
inline

returns the data pointer to a pixel with defined offset (const)

returns the data pointer to a pixel with defined offset In some functions like filters, it might be necessary to change the images ROI parameters before applying the underlying image operation. Temporarily changing the images ROI parameters causes problems in multi-threaded environments. To avoid this, this function provides access to a data pointer to an arbitrary notional ROI-offset

Parameters
iChannelselects the channel
pnotional ROI offset
Returns
data pointer with notional ROI offset p

◆ getStartIndex()

template<class Type>
int icl::core::Img< Type >::getStartIndex ( int  iIndex) const
inlineprotected

returns the start index for a channel loop

In some functions to cases must be regarded:

  • if given channel index is -1, then it has to be iterated over all image channels
  • else only the given image channel has to be touched

To avoid code doublication, one can use the following for-loop

void foo(int iChannel){
   for(int i = iIndex < 0 ? 0 : iIndex, iEnd = iIndex < 0 ? m_iChannels : iIndex+1; i < iEnd; i++)   {
         // do something
   }
}

When using the get<Start|End>Index functions the loop becomes much more readable:

void foo(int iChannel){
   for(int i=getStartIndex(iIndex), iEnd=getEndIndex(iIndex); i<iEnd ;i++){
     // do something
   }
}
Parameters
iIndexchannel index
Returns
start index for for-loops
See also
getEndIndex

◆ isIndependent()

template<class Type>
virtual bool icl::core::Img< Type >::isIndependent ( ) const
virtual

shows wheter all image channels are currently not share with another image

\copydoc bool icl::core::ImgBase::isIndependent() const

Implements icl::core::ImgBase.

◆ isNull()

template<class Type>
bool icl::core::Img< Type >::isNull ( ) const
inline

null check : null images have 0-Channels and null-size

◆ lut()

template<class Type>
Img<Type>* icl::core::Img< Type >::lut ( const Type *  lut,
Img< Type > *  dst = 0,
int  bits = 8 
) const

applys a lookup function using the given lookup table

The lookup table has 2^bits entries. Source values are assumed to be in range [0,255]. If the given destination image is 0, a new image is created and returned IPP-accellerated for icl8u

◆ mirror() [1/2]

template<class Type>
void icl::core::Img< Type >::mirror ( axis  eAxis,
int  iChannel,
const utils::Point oOffset,
const utils::Size oSize 
)
protected

in-place mirror operation on the given image rect (for internal use)

Parameters
eAxisaxis for the mirror operation
iChannelchannel index to work on
oOffsetimage rects offset to use
oSizeimage rects size to use

◆ mirror() [2/2]

template<class Type>
virtual void icl::core::Img< Type >::mirror ( axis  eAxis,
bool  bOnlyROI = false 
)
virtual

perform an in-place mirror operation on the image

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.

Implements icl::core::ImgBase.

◆ normalize()

template<class Type>
void icl::core::Img< Type >::normalize ( int  iChannel,
const utils::Range< Type > &  srcRange,
const utils::Range< Type > &  dstRange 
)
protected

Scales pixel values from given min/max values to new min/max values (for internal use)

Values exceeding the given range are set to the new min/max values. For an automatic scaling use the results of min(),max() as as arguments. (Defining a range allows to compare different images.)

Parameters
iChannelchannel index (if set to -1, then operation is
srcRangeassumption of the images range
dstRangeimage range after the operation

performed on all channels)

◆ normalizeAllChannels()

template<class Type>
void icl::core::Img< Type >::normalizeAllChannels ( const utils::Range< Type > &  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
dstRangenew image range

◆ normalizeChannel() [1/2]

template<class Type>
void icl::core::Img< Type >::normalizeChannel ( int  iChannel,
const utils::Range< Type > &  srcRange,
const utils::Range< Type > &  dstRange 
)

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

Parameters
iChannelchannel index
srcRangenotional image range befor this function call
dstRangeimage range after this function call

◆ normalizeChannel() [2/2]

template<class Type>
void icl::core::Img< Type >::normalizeChannel ( int  iChannel,
const utils::Range< Type > &  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

Parameters
iChannelchannel index
dstRangedestination image range

◆ normalizeImg() [1/2]

template<class Type>
void icl::core::Img< Type >::normalizeImg ( const utils::Range< Type > &  srcRange,
const utils::Range< Type > &  dstRange 
)

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

Parameters
srcRangenotional image range befor this function call
dstRangeimage range after this function call

◆ normalizeImg() [2/2]

template<class Type>
void icl::core::Img< Type >::normalizeImg ( const utils::Range< Type > &  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.

Parameters
dstRangedestination image range

◆ operator const Img< Type > &()

template<class Type>
icl::core::Img< Type >::operator const Img< Type > & ( ) const
inline

implicit cast to it's own reference (?) (const)

◆ operator Img< Type > &()

template<class Type>
icl::core::Img< Type >::operator Img< Type > & ( )
inline

implicit cast to it's own reference (?)

◆ operator()() [1/5]

template<class Type>
Type& icl::core::Img< Type >::operator() ( int  iX,
int  iY,
int  iChannel 
)
inline

pixel access operator

This operator may be used, to access the pixel data of the image e.g. copy of image data:

Img8u oA(Size(320,240),1),oB(Size(320,240),1);
for(int x=0;x<320;x++){
for(int y=0;y<240;y++){
oB(x,y,0)=oA(x,y,0);
}
}

Efficiency

Although the ()-operator is compiled inline, and optimized, it is very slow, as it has to select a channel internally (array access) followed by the data access of the selected channel (return array[x+w*y]). A measurement with a "-O3" binary brought the result that pixel access is up to 10 times faster when working directly with a channel data pointer. Nevertheless, the ()-operator is provided in the Img-class, as it offers a very intuitive access to the pixel data. Note: The also provided ImgIterator provides an additional ROI handling mechanism and is more than 5 times faster.

See also
ImgIterator
getIterator()
beginROI()
Parameters
iXX-Position of the referenced pixel
iYY-Position of the referenced pixel
iChannelchannel index

◆ operator()() [2/5]

template<class Type>
const Type& icl::core::Img< Type >::operator() ( int  iX,
int  iY,
int  iChannel 
) const
inline

as above, but const

◆ operator()() [3/5]

template<class Type>
PixelRef<Type> icl::core::Img< Type >::operator() ( int  x,
int  y 
)
inline

extracts a pixels channel values at once

This enables the user to write imageA(x,y) = imageB(a,b);

◆ operator()() [4/5]

template<class Type>
const PixelRef<Type> icl::core::Img< Type >::operator() ( int  x,
int  y 
) const
inline

as above, but const

◆ operator()() [5/5]

template<class Type>
Type icl::core::Img< Type >::operator() ( float  fX,
float  fY,
int  iChannel,
scalemode  eMode 
) const

sub-pixel access operator, uses given interpolation method

◆ operator=()

template<class Type>
Img<Type>& icl::core::Img< Type >::operator= ( const Img< Type > &  tSource)
inline

Assign operator (flat copy of channels) WARNING: Violates const concept.

Both images will share their channel data. Use deepCopy() to obtain a copy of an image which is not attached to the source image. Note: this implicit shallow copy can be exploited to violate ICL's const concept:

void func(const Img8u &a){
Img8u b = a;
// b is now unconst and therewith the data of
// a can b chaned
}
Parameters
tSourceReference to source object.

◆ operator[]() [1/2]

template<class Type>
Channel<Type> icl::core::Img< Type >::operator[] ( int  channel)
inline

extracts an image channel

See also
ICLUtils::iclDynMatrix.h
Parameters
channelvalid channel index

◆ operator[]() [2/2]

template<class Type>
const Channel<Type> icl::core::Img< Type >::operator[] ( int  channel) const
inline

extracts an image channel

See also
ICLUtils::iclDynMatrix.h
Parameters
channelvalid channel index

◆ printAsMatrix()

template<class Type>
void icl::core::Img< Type >::printAsMatrix ( const std::string &  format = "5.3",
bool  visROI = true 
) const

shows the image value by value at std::out

Warning: SLOW

Parameters
formatthis string is passed to printf internally uchars can be printed e.g. using format="3.0"
visROIindicates ROI-pixels with a 'r'-postfix (only if image has no full-ROI)

◆ reduce_arrays()

template<class Type>
template<typename Tsrc , typename Tdst , int Nsrc, int Ndst, typename ReduceFunc >
static void icl::core::Img< Type >::reduce_arrays ( const Tsrc *  src[Nsrc],
Tdst *  dst[Ndst],
unsigned int  dim,
ReduceFunc  reduce 
)
inlinestaticprivate

private helper function called from reduce_channels template

◆ reduce_channels()

template<class Type>
template<typename Tdst , int Nthis, int Ndst, typename ReduceFunc >
void icl::core::Img< Type >::reduce_channels ( Img< Tdst > &  dst,
ReduceFunc  reduce 
) const
inline

Utility function for combining image channels into another image.

In some application we want to combine an images channels pixel-by-pixel in any way and to store the result (or even results) in a 2nd image at the corresponding image location. This can easily be performed using the reduce channels template function. Look at the following example:

struct Thresh{
Thresh(int t):t(t*3){}
int t;
void operator()(const icl8u src[6], icl8u dst[1]) const{
*dst = 255*( (abs(src[0]-src[3])+abs(src[1]-src[4])+abs(src[2]-src[5])) > t);
}
};
Img8u bgMask(const Img8u &image,const Img8u &bgImage, int tollerance){
Img8u imageAndBG;
imageAndBG.append(&const_cast<Img8u&>(image)); // const_cast is ok here,
imageAndBG.append(&const_cast<Img8u&>(bgImage)); // we will not change them!
Img8u dst(image.getSize(),formatMatrix);
imageAndBG.reduce_channels<icl8u,6,1,Thresh>(dst,Thresh(tollerance));
return dst;
}

Performance

Source and destination channel count is given as template parameter, to allow the compiler to leave out loops over single values or to unroll short ones. Besides, the compiler is able to use fixed sized arrays on the stack, instead of dynamically allocated heap arrays. By this means performance of reduce_channels is accelerated by factor 12.

Benchmarks

Exemplarily, the example function above takes about 4-5ms on a 2GHz Core2Duo (using -O4 and -funroll-loop optimization of gcc) on a VGA-sized image (640x480)

◆ reinterpretChannels() [1/2]

template<class Type>
Img<Type>* icl::core::Img< Type >::reinterpretChannels ( format  newFmt,
Img< Type > *  poDst = 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.
poDstdestination image (exploited as possible)
Returns
shallow copie with given format of NULL if an error occured

◆ reinterpretChannels() [2/2]

template<class Type>
const Img<Type>* icl::core::Img< Type >::reinterpretChannels ( format  newFmt)
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()

template<class Type>
virtual void icl::core::Img< Type >::removeChannel ( int  iChannel)
virtual

Removes a specified channel.

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

Implements icl::core::ImgBase.

◆ replaceChannel()

template<class Type>
void icl::core::Img< Type >::replaceChannel ( int  iThisIndex,
Img< Type > *  poOtherImg,
int  iOtherIndex 
)

Replace the channel A of this image with the channel B another image.

Both images must have the same width and height.

Parameters
iThisIndexchannel to replace
iOtherIndexchannel to replace with
poOtherImgImage that contains the new channel

◆ scale()

template<class Type>
virtual void icl::core::Img< Type >::scale ( const utils::Size s,
scalemode  eScaleMode = interpolateNN 
)
virtual

perform an in-place resize of the image (keeping the data)

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

Implements icl::core::ImgBase.

◆ scaledCopy() [1/3]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::scaledCopy ( const utils::Size newSize,
scalemode  eScaleMode = interpolateNN 
) const
virtual

create a scaled copy of this image

scaled-, and flipped-Copy functionsCreate 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

Implements icl::core::ImgBase.

◆ scaledCopy() [2/3]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::scaledCopy ( ImgBase **  ppoDst = 0,
scalemode  eScaleMode = interpolateNN 
) const
virtual

create a scaled copy of this image

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

Implements icl::core::ImgBase.

◆ scaledCopy() [3/3]

template<class Type>
Img<Type>* icl::core::Img< Type >::scaledCopy ( Img< Type > *  poDst,
scalemode  eScaleMode = interpolateNN 
) const

create a scaled copy of this image

Overloaded function to create a scaled copy of an image. This function gets an Img<Type>* as destination, what allows to apply the operation without any depth-switch.

Parameters
poDstdestination image pointer, if NULL, a new Img<Type> is created
eScaleModeinterpolation method to use when scaling

◆ scaledCopyROI() [1/3]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::scaledCopyROI ( const utils::Size newSize,
scalemode  eScaleMode = interpolateNN 
) const
virtual

create a scaled copy of an images ROI with given size

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

Implements icl::core::ImgBase.

◆ scaledCopyROI() [2/3]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::scaledCopyROI ( ImgBase **  ppoDst = 0,
scalemode  eScaleMode = interpolateNN 
) const
virtual

create a scaled copy of an images ROI with given destination image

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

Implements icl::core::ImgBase.

◆ scaledCopyROI() [3/3]

template<class Type>
Img<Type>* icl::core::Img< Type >::scaledCopyROI ( Img< Type > *  poDst,
scalemode  eScaleMode = interpolateNN 
) const

create a scaled copy of this images ROI

Overloaded function to create a scaled copy of an images ROI. This function gets an Img<Type>* as destination, what allows to apply the operation without any depth-switch.

Parameters
poDstdestination image pointer, if NULL, a new Img<Type> is created
eScaleModeinterpolation method to use when scaling

◆ selectChannel() [1/2]

template<class Type>
Img<Type>* icl::core::Img< Type >::selectChannel ( int  channelIndex,
Img< Type > *  poDst = 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)
poDstdestination image
Returns
image containing only the selected channel

◆ selectChannel() [2/2]

template<class Type>
const Img<Type>* icl::core::Img< Type >::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]

template<class Type>
Img<Type>* icl::core::Img< Type >::selectChannels ( const std::vector< int > &  channelIndices,
Img< Type > *  poDst = 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
poDstdestination 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]

template<class Type>
const Img<Type>* icl::core::Img< Type >::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()

template<class Type>
virtual void icl::core::Img< Type >::setChannels ( int  iNewNumChannels)
virtual

sets the channel count to a new value

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

Implements icl::core::ImgBase.

◆ setSize()

template<class Type>
virtual void icl::core::Img< Type >::setSize ( const utils::Size s)
virtual

resizes the image to new values

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

Implements icl::core::ImgBase.

◆ shallowCopy() [1/5]

template<class Type>
Img<Type>& icl::core::Img< Type >::shallowCopy ( const Img< Type > &  tSource)
private

Private assign operator (internally used)

This must be kept private! Because the assign operator could otherwise be exploited to violate the Img's const concept

◆ shallowCopy() [2/5]

template<class Type>
virtual Img<Type>* icl::core::Img< Type >::shallowCopy ( const utils::Rect roi,
const std::vector< int > &  channelIndices,
format  fmt,
utils::Time  time = utils::Time::null,
ImgBase **  ppoDst = NULL 
)
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

Implements icl::core::ImgBase.

◆ shallowCopy() [3/5]

template<class Type>
const Img<Type>* icl::core::Img< Type >::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() [4/5]

template<class Type>
Img<Type>* icl::core::Img< Type >::shallowCopy ( const utils::Rect roi,
Img< Type > *  poDst = 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
poDstpointer 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() [5/5]

template<class Type>
const Img<Type>* icl::core::Img< Type >::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

◆ subPixelLIN()

template<class Type>
float icl::core::Img< Type >::subPixelLIN ( float  fX,
float  fY,
int  iChannel 
) const

sub-pixel access using linear interpolation

◆ subPixelNN()

template<class Type>
float icl::core::Img< Type >::subPixelNN ( float  fX,
float  fY,
int  iChannel 
) const
inline

sub-pixel access using nearest neighbor interpolation

◆ subPixelRA() [1/2]

template<class Type>
float icl::core::Img< Type >::subPixelRA ( float  fX,
float  fY,
float  w,
float  h,
int  iChannel 
) const

sub-pixel access using region average interpolation

◆ subPixelRA() [2/2]

template<class Type>
float icl::core::Img< Type >::subPixelRA ( const unsigned int  xB,
const unsigned int  xE,
const unsigned int  yB,
const unsigned int  yE,
const float  xBMul,
const float  xEMul,
const float  BMul,
const float  yEMul,
const Type *  d,
const unsigned int  w 
) const

◆ swapChannels()

template<class Type>
virtual void icl::core::Img< Type >::swapChannels ( int  iIndexA,
int  iIndexB 
)
virtual

Swap channel A and B.

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

Implements icl::core::ImgBase.

◆ transform()

template<class Type>
template<typename UnaryFunction , class dstType >
Img<dstType>& icl::core::Img< Type >::transform ( UnaryFunction  f,
Img< dstType > &  dst 
) const
inline

STL based "transform" implementation applying an Unary function on ROI-pixles with given destination image.

Internally this function uses std::transform. Example:

#include <ICLQt/Quick.h>
inline icl8u t_func(const float &f){
return f>128 ? 0 : 255;
}
int main(){
ImgQ a = scale(create("parrot"),0.2);
Img8u b(a.getParams());
a.transform(t_func,b);
show(cvt(b));
return 0;
}
Parameters
funary function of functor implementing "dstType operator()(const Type &val)"
dstdestination image with identical ROI-size and channel count (compared to this image)

◆ transform_C()

template<class Type>
template<typename UnaryFunction , class dstType >
Img<dstType>& icl::core::Img< Type >::transform_C ( UnaryFunction  f,
int  srcChannel,
int  dstChannel,
Img< dstType > &  dst 
) const
inline

STL based "transform" implementation applying an Unary function on ROI-pixles with given destination image.

Internally this function uses std::transform. Example:

#include <ICLQt/Quick.h>
struct Thresh{
inline float operator()(const float &f){ return f>128 ? 0 : 255; }
};
int main(){
ImgQ a = scale(create("parrot"),0.2);
ImgQ b(a.getParams());
a.transform_C(Thresh(),1,2,b);
show(b);
return 0;
}
Parameters
funary function of functor implementing "dstType operator()(const Type &val)"
srcChannelvalid channel index for this image
dstChannelvalid channel index for dst image
dstdestination image with identical ROI-size to this images ROI-size

Friends And Related Function Documentation

◆ combineImages

template<class Type>
template<class ImgType >
const ImgType* combineImages ( const std::vector< const ImgType * > &  vec,
ImgBase **  ppoDst 
)
friend

Member Data Documentation

◆ m_vecChannels

template<class Type>
std::vector<utils::SmartArray<Type> > icl::core::Img< Type >::m_vecChannels
protected

internally used storage for the image channels

◆ null

template<class Type>
const Img<Type> icl::core::Img< Type >::null
static

null sized and null channel image


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