Image Component Library (ICL)
|
The Img class implements the ImgBase Image interface with type specific functionalities . More...
#include <Img.h>
Public Member Functions | |
Img (const ImgParams ¶ms=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 ImgBase * | shallowCopy (const utils::Rect &roi, const std::vector< int > &channelIndices, format fmt, utils::Time time=utils::Time::null) const |
ImgBase * | reinterpretChannels (format newFmt, ImgBase **ppoDst=NULL) |
Create a shallow copy of this image with a new format. More... | |
const ImgBase * | reinterpretChannels (format newFmt) const |
Create a shallow copy of this image with a new format (const version) More... | |
ImgBase * | shallowCopy (const utils::Rect &roi, ImgBase **ppoDst=NULL) |
Create a shallow copy of the image. More... | |
ImgBase * | shallowCopy (ImgBase **ppoDst=NULL) |
const ImgBase * | shallowCopy (const utils::Rect &roi) const |
Create a shallow copy of a const source image. More... | |
ImgBase * | selectChannels (const std::vector< int > &channelIndices, ImgBase **ppoDst=0) |
Create a shallow copy of selected channels of an image. More... | |
ImgBase * | selectChannel (int channelIndex, ImgBase **ppoDst=0) |
Create a shallow copy of a single image channel of an image. More... | |
const ImgBase * | selectChannels (const std::vector< int > &channelIndices) const |
Create a shallow copy of selected channels of a const image. More... | |
const ImgBase * | selectChannel (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... | |
ImgBase * | convert (depth d) const |
returns a converted (or deep copied) instance of this image More... | |
ImgBase * | convert (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... | |
ImgBase * | convertROI (depth d) const |
returns a converted (or deep copied) instance of this images ROI More... | |
ImgBase * | convertROI (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 ImgParams & | getParams () const |
returns all params in terms of a const ImgParams reference More... | |
const utils::Size & | getSize () 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::Rect & | getROI () 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 ¶ms) |
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< icl64f > | 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< icl64f > | getMinMax () 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 ¶ms) |
checks if the image has the given parameters More... | |
bool | isEqual (const ImgParams ¶ms, 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 ¶ms) | |
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... | |
The Img class implements the ImgBase Image interface with type specific functionalities .
forward declaration of the Img-class
typedef const Type* icl::core::Img< Type >::const_iterator |
const iterator type (just a const pointer)
typedef const ImgIterator<Type> icl::core::Img< Type >::const_roi_iterator |
type definition for a const ROI iterator
typedef Type* icl::core::Img< Type >::iterator |
iterator type (just a data pointer)
typedef ImgIterator<Type> icl::core::Img< Type >::roi_iterator |
type definition for ROI iterator
icl::core::Img< Type >::Img | ( | const ImgParams & | params = ImgParams::null | ) |
creates a new image specified by the given param struct
params | initializing image parameters, if null, then a null image is created |
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"
size | image size |
channels | Number of Channels |
icl::core::Img< Type >::Img | ( | const utils::Size & | s, |
format | fmt | ||
) |
Creates an image with specified size, number of channels and format.
s | size of the new image |
fmt | (color)-format of the image |
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
s | size of the image |
channels | channel count of the image (must be compatible to fmt) |
fmt | format of the image (must be compatible to channels) |
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
size | new image size |
format | (color)-format of the image |
vptData | holds 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. |
passOwnerShip | flag to specify the passed ownership |
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
size | new image size |
channels | channel count of the image (format is set to "formatMatrix") |
vptData | holds 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. |
passOwnerShip | flag to specify the passed ownership |
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
size | size of the image |
channels | channel count of the image (must be compatible to fmt) |
fmt | format of the image (must be compatible to channels) |
vptData | array 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 |
passOwnerShip | flag to specify the passed ownership |
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:
tSrc | non-const reference of source instance |
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.
c1 | first image channel (mandatory) (if this is null, the image becomes null) |
c2 | optional 2nd image channel. Must have the same size as c1. |
c3 | optional 3rd image channel. Must have the same size as c1 and c2. |
c4 | optional 4th image channel. Must have the same size as c1 - c3. |
c5 | optional 5th image channel. Must have the same size as c1 - c4. |
icl::core::Img< Type >::~Img | ( | ) |
Destructor.
|
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
|
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
|
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.
src | source image |
iChannel | channel to append (or all, if < 0) |
|
inline |
Append a set of selected channels from source image.
src | source image |
vChannels | vector of channels indices |
|
inline |
returns the image iterator (equal to getData(channel))
|
inline |
returns the image iterator (equal to getData(channel)) (const)
|
inline |
returns the iterator for an images ROI
|
inline |
returns the iterator for an images ROI (const)
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.
iChannel | Channel to fill with zero (default: -1 = all channels) |
tValue | destination value (default: 0) |
bROIOnly | if set false, the whole image is set to tValue |
|
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:
f | binary function or functor implementing "dstType operator() const(Type &a, otherSrcType &b) const" |
otherSrc | 2nd source image |
dst | destination image |
|
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:
f | binary function of functor implementing "dstType operator() const(Type &a, otherSrcType &b) const" |
thisChannel | valid channel of this image |
otherSrcChannel | valid channel index for give 2nd source image |
dstChannel | valid channel index of dst image |
otherSrc | 2nd source image (ROI-size must be equal to this' ROI size) |
dst | destination image (ROI-size must be equal to this' ROI size) |
|
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
|
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
ppoDst | optionally given destination image |
Implements icl::core::ImgBase.
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.
poDst | destination image, if NULL, a new Img<Type> is created |
|
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.
ppoDst | optionally given destination image |
Implements icl::core::ImgBase.
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.
poDst | destination 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) |
|
virtual |
Makes the image channels inside the Img independent from other Img.
Makes the image channels independent from other images.
iIndex | index 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.
|
inline |
|
inline |
returns the image end-iterator (equal to getData(channel)+getDim())
|
inline |
returns the image end-iterator (const)
|
inline |
returns the end-iterator for an images ROI
the returned iterator must not be incremented or decremented!
|
inline |
returns the end-iterator for an images ROI (const)
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)
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)
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)
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)
|
inline |
extracts all image channels at once into given channel pointer
|
inline |
this function is forbidden, it produces an error message
This would allow the programme to violate the Imgs const concept
|
inline |
extracts all image channels at once into given channel pointer (const)
Plese note that the given dst-pointer must also be const
|
inline |
extracts given channel as DynMatrix<Type>
|
inline |
extracts given channel as DynMatrix<Type> const
|
inline |
extracts all data pointers into given destination pointer
|
inline |
this function is forbidden, it produces an error message
This would allow the programme to violate the Imgs const concept
|
inline |
extracts all data pointers into given destination pointer (const)
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
|
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.
|
virtual |
fills all non-ROI pixels with a given value
Implements icl::core::ImgBase.
|
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.
|
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.
|
inline |
fills the given channel with given source type value
|
inline |
fills the given channel's with given source type value
|
inline |
fills the whole image with given source type value
|
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:
f | unary function or functor implementing "AnyType operator()(Type &val)" |
|
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:
f | unary function or functor implementing "AnyType operator()(Type &val)" |
channel | valid channel index for this image |
|
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
iChannel | specifies the channel |
|
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
iChannel | specifies the channel |
|
inlinevirtual |
returns the raw- data pointer of an image channel
returns a pointer to first data element of a given channel
Implements icl::core::ImgBase.
|
inlinevirtual |
returns the raw- data pointer of an image channel (const)
returns a pointer to first data element of a given channel
Implements icl::core::ImgBase.
|
inlineprotected |
returns the end index for a channel loop
this function behaves essentially like the above function
iIndex | channel index |
|
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.
Implements icl::core::ImgBase.
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.
Type icl::core::Img< Type >::getMax | ( | int | iChannel, |
utils::Point * | coords = 0 |
||
) | const |
Returns max pixel value of channel iChannel within ROI.
iChannel | Index of channel |
coords | (optinal) if not null, the pixel position of the max is written into this argument |
Type icl::core::Img< Type >::getMax | ( | ) | const |
return minimal pixel value over all channels (restricted to ROI)
Type icl::core::Img< Type >::getMin | ( | int | iChannel, |
utils::Point * | coords = 0 |
||
) | const |
Returns min pixel value of channel iChannel within ROI.
iChannel | Index of channel |
coords | (optinal) if not null, the pixel position of the min is written into this argument |
Type icl::core::Img< Type >::getMin | ( | ) | const |
return maximal pixel value over all channels (restricted to ROI)
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.
iChannel | Index 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 |
const utils::Range<Type> icl::core::Img< Type >::getMinMax | ( | ) | const |
return minimal and maximal pixel values over all channels (restricted to ROI)
|
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
iChannel | specifies the channel |
|
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
iChannel | specifies the channel |
|
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
iChannel | selects the channel |
p | notional ROI offset |
|
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
iChannel | selects the channel |
p | notional ROI offset |
|
inlineprotected |
returns the start index for a channel loop
In some functions to cases must be regarded:
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 } }
iIndex | channel index |
|
virtual |
shows wheter all image channels are currently not share with another image
\copydoc bool icl::core::ImgBase::isIndependent() const
Implements icl::core::ImgBase.
|
inline |
null check : null images have 0-Channels and null-size
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
|
protected |
in-place mirror operation on the given image rect (for internal use)
eAxis | axis for the mirror operation |
iChannel | channel index to work on |
oOffset | image rects offset to use |
oSize | image rects size to use |
|
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
eAxis | axis for the mirror operations |
bOnlyROI | if set, only the ROI of this image is mirrored, else the whole image is mirrored. |
Implements icl::core::ImgBase.
|
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.)
iChannel | channel index (if set to -1, then operation is |
srcRange | assumption of the images range |
dstRange | image range after the operation |
performed on all channels)
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.
dstRange | new image range |
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.
iChannel | channel index |
srcRange | notional image range befor this function call |
dstRange | image range after this function call |
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
iChannel | channel index |
dstRange | destination image range |
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.
srcRange | notional image range befor this function call |
dstRange | image range after this function call |
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.
dstRange | destination image range |
|
inline |
implicit cast to it's own reference (?) (const)
|
inline |
implicit cast to it's own reference (?)
|
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); } }
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.
iX | X-Position of the referenced pixel |
iY | Y-Position of the referenced pixel |
iChannel | channel index |
|
inline |
as above, but const
|
inline |
extracts a pixels channel values at once
This enables the user to write imageA(x,y) = imageB(a,b);
|
inline |
as above, but const
Type icl::core::Img< Type >::operator() | ( | float | fX, |
float | fY, | ||
int | iChannel, | ||
scalemode | eMode | ||
) | const |
sub-pixel access operator, uses given interpolation method
|
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:
tSource | Reference to source object. |
|
inline |
extracts an image channel
channel | valid channel index |
|
inline |
extracts an image channel
channel | valid channel index |
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
format | this string is passed to printf internally uchars can be printed e.g. using format="3.0" |
visROI | indicates ROI-pixels with a 'r'-postfix (only if image has no full-ROI) |
|
inlinestaticprivate |
private helper function called from reduce_channels template
|
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:
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.
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)
|
inline |
Create a shallow copy of this image with a new format.
newFmt | new format to choose. This must be compatible to the channel count of this image. |
poDst | destination image (exploited as possible) |
|
inline |
Create a shallow copy of this image with a new format (const version)
newFmt | new format to choose. This must be compatible to the channel count of this image. |
|
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.
iChannel | Index of channel to remove |
Implements icl::core::ImgBase.
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.
iThisIndex | channel to replace |
iOtherIndex | channel to replace with |
poOtherImg | Image that contains the new channel |
|
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.
s | new size of this image |
eScaleMode | interpolation method to use for the scaling operation |
Implements icl::core::ImgBase.
|
virtual |
create a scaled copy of this image
scaled-, and flipped-Copy functionsCreate a scaled copy with given size of an image.
newSize | size of the new image |
eScaleMode | interpolation method to use when scaling the image |
Implements icl::core::ImgBase.
|
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.
ppoDst | optionally given destination image pointer |
eScaleMode | interpolation method to use when scaling the image |
Implements icl::core::ImgBase.
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.
poDst | destination image pointer, if NULL, a new Img<Type> is created |
eScaleMode | interpolation method to use when scaling |
|
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.
newSize | size of the new image |
eScaleMode | interpolation method to use when scaling the image |
Implements icl::core::ImgBase.
|
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.
ppoDst | optionally given destination image pointer |
eScaleMode | interpolation method to use when scaling the image |
Implements icl::core::ImgBase.
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.
poDst | destination image pointer, if NULL, a new Img<Type> is created |
eScaleMode | interpolation method to use when scaling |
|
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
channelIndex | index of the channel to select (if invalid, NULL is returned) |
poDst | destination image |
|
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
channelIndex | index of the channel to select (if invalid, NULL is returned) |
|
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.
channelIndices | vector containing channel indices to copy |
poDst | destination image (if Null, a new one is created) |
|
inline |
Create a shallow copy of selected channels of a const image.
channelIndices | vector containing channel indices to copy |
|
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
iNewNumChannels | new channel count |
Implements icl::core::ImgBase.
|
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.
s | new image size (if x or y is < 0, the original width/height is used) |
Implements icl::core::ImgBase.
|
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
|
virtual |
Create a shallow copy of an image with given
ppoDst | destination image which is exploited if possible, or otherwise reallocated |
roi | ROI of the new Image |
channelIndices | indices to select from the source image. These channels are shallow-copied into the destination image |
fmt | format 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 |
time | new timestamp for the returned image |
Implements icl::core::ImgBase.
|
inline |
Create a shallow copy of an image with given (const version)
roi | ROI of the new Image |
channelIndices | indices to select from the source image. These channels are shallow-copied into the destination image (if size is null, all channels are selected) |
fmt | format 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 |
time | new timestamp for the returned image |
|
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.
poDst | pointer 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; |
roi | new ROI of the new image. If Rect::null, the source images roi is used. |
|
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.
roi | ROI of the returned image (Rect::null is not allowed!) |
float icl::core::Img< Type >::subPixelLIN | ( | float | fX, |
float | fY, | ||
int | iChannel | ||
) | const |
sub-pixel access using linear interpolation
|
inline |
sub-pixel access using nearest neighbor interpolation
float icl::core::Img< Type >::subPixelRA | ( | float | fX, |
float | fY, | ||
float | w, | ||
float | h, | ||
int | iChannel | ||
) | const |
sub-pixel access using region average interpolation
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 |
|
virtual |
Swap channel A and B.
Swap channel A and B. The channel swap operation is shallow; only the channel pointers are swapped.
iIndexA | Index of channel A; |
iIndexB | Index of channel B |
Implements icl::core::ImgBase.
|
inline |
STL based "transform" implementation applying an Unary function on ROI-pixles with given destination image.
Internally this function uses std::transform. Example:
f | unary function of functor implementing "dstType operator()(const Type &val)" |
dst | destination image with identical ROI-size and channel count (compared to this image) |
|
inline |
STL based "transform" implementation applying an Unary function on ROI-pixles with given destination image.
Internally this function uses std::transform. Example:
f | unary function of functor implementing "dstType operator()(const Type &val)" |
srcChannel | valid channel index for this image |
dstChannel | valid channel index for dst image |
dst | destination image with identical ROI-size to this images ROI-size |
|
friend |
|
protected |
internally used storage for the image channels
|
static |
null sized and null channel image