Image Component Library (ICL)
|
Classes | |
class | icl::core::Channel< T > |
Utility helper class for faster and more convenient access to single channel image data. More... | |
class | icl::core::Img< Type > |
The Img class implements the ImgBase Image interface with type specific functionalities . More... | |
struct | icl::core::ImgBasePtrPtr< T > |
utility class that helps for an implicit conversion between Img<T>* to ImgBase** More... | |
class | icl::core::ImgBase |
ImgBase is the Image-Interface class that provides save access to underlying Img-template . More... | |
class | icl::core::ImgIterator< Type > |
Iterator class used to iterate through an Images ROI-pixels. More... | |
class | icl::core::ImgParams |
The ImgParams class stores all image parameters . More... | |
Functions | |
ICLCore_API ImgBase * | icl::core::imgNew (depth d=depth8u, const ImgParams ¶ms=ImgParams::null) |
create a new image instance of the given depth type and with given parameters More... | |
ImgBase * | icl::core::imgNew (depth d, const utils::Size &size, format fmt, const utils::Rect &roi=utils::Rect::null) |
creates a new Img (see the above function for more details) More... | |
ImgBase * | icl::core::imgNew (depth d, const utils::Size &size, int channels=1, const utils::Rect &roi=utils::Rect::null) |
creates a new Img (see the above function for more details) More... | |
ImgBase * | icl::core::imgNew (depth d, const utils::Size &size, int channels, format fmt, const utils::Rect &roi=utils::Rect::null) |
creates a new Img (see the above function for more details) More... | |
ICLCore_API ImgBase * | icl::core::ensureDepth (ImgBase **ppoImage, depth eDepth) |
ensures that an image has the specified depth More... | |
ICLCore_API ImgBase * | icl::core::ensureCompatible (ImgBase **dst, depth d, const ImgParams ¶ms) |
ensures that an image has given depth and parameters More... | |
ImgBase * | icl::core::ensureCompatible (ImgBase **dst, depth d, const utils::Size &size, int channels, const utils::Rect &roi=utils::Rect::null) |
ensures that an image has given depth, size, number of channels and ROI More... | |
ImgBase * | icl::core::ensureCompatible (ImgBase **dst, depth d, const utils::Size &size, format fmt, const utils::Rect &roi=utils::Rect::null) |
ensures that an image has given depth, size, format and ROI More... | |
ICLCore_API ImgBase * | icl::core::ensureCompatible (ImgBase **dst, depth d, const utils::Size &size, int channels, format fmt, const utils::Rect &roi=utils::Rect::null) |
ensures that an image has given parameters More... | |
ICLCore_API ImgBase * | icl::core::ensureCompatible (ImgBase **dst, const ImgBase *src) |
ensures that the destination image gets same depth, size, channel count, depth, format and ROI as source image More... | |
template<class T > | |
ImgBasePtrPtr< T > | icl::core::bpp (Img< T > *image) |
utility function to cast an Img<T> implicitly into an ImgBase ** More... | |
template<class T > | |
ImgBasePtrPtr< T > | icl::core::bpp (Img< T > &image) |
utility function to cast an Img<T>* implicitly into an ImgBase ** More... | |
template<class ImgType > | |
const ImgType * | icl::core::combineImages (const std::vector< const ImgType * > &vec) |
Combine several images using shallow copy. More... | |
template<class ImgType > | |
ImgType * | icl::core::combineImages (const std::vector< ImgType * > &vec) |
Combine several images using shallow copy. Non-const version. More... | |
template<class T > | |
void | icl::core::deepCopyChannel (const Img< T > *src, int srcC, Img< T > *dst, int dstC) |
Copies the channel from one image to another. More... | |
template<class S , class D > | |
void | icl::core::convertChannel (const Img< S > *src, int srcC, Img< D > *dst, int dstC) |
copies/converts the data from one image to another image (IPP-OPTIMIZED) More... | |
template<class T > | |
void | icl::core::clearChannelROI (Img< T > *im, int c, T clearVal, const utils::Point &offs, const utils::Size &size) |
sets an arbitrary image ROI to a given value More... | |
template<class T > | |
void | icl::core::deepCopyChannelROI (const Img< T > *src, int srcC, const utils::Point &srcOffs, const utils::Size &srcSize, Img< T > *dst, int dstC, const utils::Point &dstOffs, const utils::Size &dstSize) |
copies the channel roi from one image to another More... | |
scaling of channel ROIs | |
scales an image channels ROI into another images ROI (with implicit type conversion) (IPP-OPTIMIZED) | |
template<class T > | |
ICLCore_API void | icl::core::flippedCopyChannelROI (axis eAxis, const Img< T > *src, int srcC, const utils::Point &srcOffs, const utils::Size &srcSize, Img< T > *dst, int dstC, const utils::Point &dstOffs, const utils::Size &dstSize) |
mirror copy ROI data from one image to the ROI of another image (IPP-OPTIMIZED) More... | |
ICLCore_API void | icl::core::flippedCopy (axis eAxis, const ImgBase *poSrc, ImgBase **ppoDst=0) |
mirror copy of an image from source to destination image (1:1 copy) More... | |
ICLCore_API void | icl::core::flippedCopyROI (axis eAxis, const ImgBase *poSrc, ImgBase **ppoDst=0) |
mirror copy of an images ROI into a destination images ROI More... | |
ICL is a C++ image processing library, developed in the Neuroinformatics Group at the University of Bielefeld in Germany. ICL provides a large set of features for image acquisition, image processing and image visualization. During the design and development process, the following main goals took center stage:
ICL provides all necessary building blocks for the development of complex computer-vision applications.
#include <ICLQt/Common.h> GUI gui; GenericGrabber grabber; void init(){ grabber.init(pa("-i")); gui << Image().handle("image") << Show(); } void run(){ gui["image"] = grabber.grab(); } int main(int n, char **args){ } |
viewer.cpp
PKG_CONFIG_PATH
variableCXXFLAGS=pkg-config --libs --cflags icl
make viewer
./viewer -input unicap '*'
More examples for using ICL are given in the online ICL-tutorial on <a href="http://www.iclcv.org>ICL's website
ICL consists of currently 11 packages that are listed in the main menu at the left.
(*) The packages ICLQt and ICLOpenCV depend compulsorily on the corresponding external software dependencies Qt4 and OpenCV. Consequently these packages are not available if these dependencies are missing. |
We use inheritance and class templates for ICL's image representation: The ImgBase class defines an abstract interface, that manages all image information except image pixel data. These abstract image features are:
The ImgBase interface is implemented by the template class Img<T> which implements all abstract ImgBase-functions and aggregates a vector of planar image channel data pointers. Internally, these channel data pointers use reference counting to allow shallow image copies. The Img<T> template also adds functions for type-safe data access:
|
As most common image formats image processing use the upper left image corner as data origen, ICL follows this convention as well. Howerver, many image operation like filtering or thresholding works without regarding the image contents at all. Nonetheless, we suggest to use this standard, as it is particularly important for I/O-routines or image visualization and - not at least - whenever discussing about ICL images.
The Img treats images as a stack of image slices – channels. Channels can be shared by multiple Img instances, which is especially important for fast shallow images copies. Actually, it is possible to freely compose existing channels (within several "parent images") to another new image.
Attention: The newly composed image shares its channel data with the original images, such that modifications will effect all images equally. In order to get an independent image a deep-copy as well as a so called detach method are provided. The latter replaces the "shared" image channel(s) with new independent ones. Shared channel data are stored using the boost-like shared pointer class SmartPtr, which uses reference counting for autonomous garbage collection in order to realease unused image channels.
The Img template is not implemented completely inline to reduce compilation expense. Therefore, the Img template is instantiated for the following types T
Derived from this types, Img-classes are predefined as follows
Each of these data types has several advantages/disadvantages. The greatest disadvantage of the integer types, is their bounded range (e.g. 0-255 for icl8u), which has the effect, that all information has to be scaled to this range, and all image processing functions must take care that no range-overflow occurs during calculation. Furthermore the limited range may cause loss of information - particular in complex systems. However integer types can often be processed significantly faster. In particular the use of 8-bit unsigned integer images relieves the the memory interface due to it's lower memory usage.
A nice rule of thumb is: If processing speed matters, use Img8u images whenever it's possible and avoid Img64f because double processing is much slower on (still common) 32 bit machines (as long as you do not really need double precision)
Each image can be set up with a rectangular region of interest. Nearly all algorithms work only on the pixels within the ROI. If a function does not support ROI handling it will be noticed in the documentation. There are several ways to realize ROI handling in functions. The most common way is to use the ImgIterator with can be accessed using the STL-style functions beginROI(channel) and endROI(channel).
An ImgBase image provides information about the (color) format, that is associated with the image data represented by the images channels. Color is written in brackets, as not all available formats imply color-information. The most known color space is probably the RGB color space. If an ImgBase image has the format formatRGB, than this implies the following:
All additional implemented functions and classes regard this information. The currently available Img formats are member of the enum Format. A special format: formatMatrix can be used for arbitrary purpose.
ICL Images use the const concept of C++ to ensure pixel data of const Images (of type const ImgBase or more precisely const Img<T>) is not changed, i.e. it is only accessible for reading. Unfortunately this leads to a conflict with the "shallow-copy" concept of ICL images.
To avoid this conflict, we tried to forbid creating un-const shallow copies of const images by implementing no default copy constructor:
but an un-const version of this:
Here we face some GCC related problem, because gcc is not able for an implicit cast of an Img<T> to an Img<T>& in constructor calls:
Here, the compiler gives error: "Can't find constructor Img<T>(Img<T>)". In fact, this constructor can not exist: it must have the following syntax: Img<T>(Img<T>&)
Probably further gcc versions will fix this problem!
Until then, we accept the const leak at constructor and assignment operator and reimplemented them as ..(const Img<T> &other)
The Intel Integrated Performance Primitives (Intel IPP) and the Intel Math Kernel Library (Intel MKL) are assembler libraries that provide a C-interface to a large set of highly optimized and hardware accelerated functions for image processing, and other numerical problems for all processors providing MMX and SSE instruction sets, i.e. most common Intel and AMD processors. As far as we know, Intel IPP and Intel MKL can be used freely for non-commercial use, but not for research. Fortunately, IPP/MKL support is purely optional. Therefore you can simply develop your application with an ICL-build without IPP/MKL-optimization and re-link it against an optimized ICL-build lateron.
If Intel IPP is available, it is highly integrated into ICL:
We tuned the Img-class to facilitate the use of IPP functions.
In contrast to the matrix package for small matrices, which is optimized for matrices up to dimensions of 6x6, Intel MKL is optimized for larger matrices. As under certain conditions, MKL is more then 100 times faster, we decided to add MKL support as well. However, MKL is currently only used in the implementation of some DynMatrix multiplication functions in the ICLUtils package.
If you like to explore the ICLCore documentation by your own, take a look a the following sub modules:
The list of 3rd party dependencies is given on <a href="http://www.iclcv.org>ICL's website
ImgBasePtrPtr<T> icl::core::bpp | ( | Img< T > * | image | ) |
utility function to cast an Img<T> implicitly into an ImgBase **
This function may be useful, whenever you are working with Img<T> objects are Pointers. As some functions expect ImgBase** arguments to ensure, that the destination image can be adapted even in its depth, this function can be used to get an ImgBase** that points to a pointer of the given image. This is a necessary concept, but mutch additional work, if you are just want to try out some algorithm on your Img<T>. If you are shure, that the result image will not be adapted by the function you can easily use the bpp-function, which will additionally warn you if this assumption was wrong. The following code example demonstrates this:
ImgBasePtrPtr<T> icl::core::bpp | ( | Img< T > & | image | ) |
|
inline |
sets an arbitrary image ROI to a given value
This function is used as basic operation for higher level image operation like Img<T>::clear(T value).
im | image |
c | channel |
clearVal | value for the cleared pixels |
offs | lower left point for the to-be-cleared region |
size | size of the to-be-cleared region |
const ImgType* icl::core::combineImages | ( | const std::vector< const ImgType * > & | vec | ) |
Combine several images using shallow copy.
ImgType* icl::core::combineImages | ( | const std::vector< ImgType * > & | vec | ) |
Combine several images using shallow copy. Non-const version.
|
inline |
copies/converts the data from one image to another image (IPP-OPTIMIZED)
The deepCopyChannel function is a higher lever wrapper for the icl::copy(..) function. It extracts the data pointers and data dimension from the source- and destination image to call icl::copy(..)
src | source image |
srcC | source images channel |
dst | destination image |
dstC | destination image channel |
|
inline |
Copies the channel from one image to another.
|
inline |
copies the channel roi from one image to another
{{{ check function }}}Essential deep copy function.
src | source image |
srcC | source channel |
srcOffs | source images ROI offset |
srcSize | source images ROI size |
dst | destination image |
dstC | destination channel |
dstOffs | destination images ROI offset |
dstSize | destination images ROI size (must be equal to srcSize) |
ICLCore_API ImgBase* icl::core::ensureCompatible | ( | ImgBase ** | dst, |
depth | d, | ||
const ImgParams & | params | ||
) |
ensures that an image has given depth and parameters
|
inline |
ensures that an image has given depth, size, number of channels and ROI
If the given pointer to the destination image is 0, a new image with appropriate properties is created. Else the image properties are checked and adapted to the new values if neccessary.
dst | points the destination ImgBase*. If the images depth hasa to be converted, then a new Img<T>* is created at (*dst). |
d | desired image depth |
size | desired image size |
channels | desired number of channels, if eFormat == formatMatrix for other format, the number of channels is determined by the format |
roi | desired ROI rectangle. If the ROI parameters are not given, the ROI will comprise the whole image. |
|
inline |
ensures that an image has given depth, size, format and ROI
ICLCore_API ImgBase* icl::core::ensureCompatible | ( | ImgBase ** | dst, |
depth | d, | ||
const utils::Size & | size, | ||
int | channels, | ||
format | fmt, | ||
const utils::Rect & | roi = utils::Rect::null |
||
) |
ensures that an image has given parameters
The given format must be compatible to the given channel count. If not: The format is set to "formatMatrix" and an exception is thrown.
ICLCore_API ImgBase* icl::core::ensureCompatible | ( | ImgBase ** | dst, |
const ImgBase * | src | ||
) |
ensures that the destination image gets same depth, size, channel count, depth, format and ROI as source image
If the given pointer to the destination image is 0, a new image is created as a deep copy of poSrc. Else the image properties are checked and adapted to the new values if neccessary. Note: If the destination images depth differs from the source images depth, it is adapted by deleting the old destination pointer by calling delete *ppoDst and creating a brand new Img<T> where T is the destination images depth.
dst | points the destination ImgBase*. If the images depth has to be converted, then a new Img<T>* is created, at (*ppoDst). |
src | source image. All params of this image are extracted to define the destination parameters for *ppoDst. |
ICLCore_API ImgBase* icl::core::ensureDepth | ( | ImgBase ** | ppoImage, |
depth | eDepth | ||
) |
ensures that an image has the specified depth
This function will delete the original image pointed by (*ppoImage) and create a new one with identical parameters, if the given depth parameter is not the images depth. If the given image pointer (*ppoImage) is NULL, then an empty image of specified depth es created at *ppoImage. If ppoImage is NULL a new Image is created and returned. call:
void func(ImgBase **ppoDst){ ImgBase *poDst = ensureDepth(ppoDst,anyDepth); }
to ensure that an image is valid.
ppoImage | pointer to the image-pointer |
eDepth | destination depth of the image |
ICLCore_API void icl::core::flippedCopy | ( | axis | eAxis, |
const ImgBase * | poSrc, | ||
ImgBase ** | ppoDst = 0 |
||
) |
mirror copy of an image from source to destination image (1:1 copy)
This function creates a flipped instance of this image. Even the ROI is flipped internally. Example:
...... ...... r = roi ..rrrr -> flipped x -> rrrr.. ..rrrr rrrr..
eAxis | axis to flip |
poSrc | source image |
ppoDst | image. This image is exploited if possible. It is adjusted to the source image in depth, size,channels,format,and time |
ICLCore_API void icl::core::flippedCopyChannelROI | ( | axis | eAxis, |
const Img< T > * | src, | ||
int | srcC, | ||
const utils::Point & | srcOffs, | ||
const utils::Size & | srcSize, | ||
Img< T > * | dst, | ||
int | dstC, | ||
const utils::Point & | dstOffs, | ||
const utils::Size & | dstSize | ||
) |
mirror copy ROI data from one image to the ROI of another image (IPP-OPTIMIZED)
This function is used by flippedCopyROI and Mirror operator.
eAxis | mirror axis (axisHorz, axisVert or axisBoth) |
src | source image |
srcC | source image channel |
srcOffs | source images ROI-offset (src->getROIOffset() is not regarded) |
srcSize | source images ROI-size (src->getROISize() is not regarded) |
dst | destination image |
dstC | destination image channel |
dstOffs | destination images ROI-offset (dst->getROIOffset() is not regarded) |
dstSize | destination images ROI-size (dst->getROISize() is not regarded) |
dstSize | destination images ROI-size (dst->getROISize() is not regarded) |
ICLCore_API void icl::core::flippedCopyROI | ( | axis | eAxis, |
const ImgBase * | poSrc, | ||
ImgBase ** | ppoDst = 0 |
||
) |
mirror copy of an images ROI into a destination images ROI
Example:
...... ...... R,r = roi ..RRrr -> flipped x -> rrRR.. ..RRrr rrRR..
eAxis | axis to flip |
poSrc | source image |
ppoDst | destination image (expoited if possible). This images ROI size must be equal to ppoDst's ROI size otherwise an errormessage is shown, and the function returns 0. If ppoDst is null, a new image is created with size of this images ROI size. If ppoDst points to NULL, the new image is created at *ppoDst. |
ICLCore_API ImgBase* icl::core::imgNew | ( | depth | d = depth8u , |
const ImgParams & | params = ImgParams::null |
||
) |
create a new image instance of the given depth type and with given parameters
This function provides a common interface to instantiate images of arbitrary depth, selecting the appropriate constructor of the derived class Img<T>.
Instead of selecting the correct constructor by yourself, you can simply call this common constructor function. To illustrate the advantage, look at the following example:
class Foo{ public: Foo(...,Depth eDepth,...): poImage(eDepth==depth8u ? new Img8u(...) : new Img32f(...)){ } private: ImgBase *poImage; };
This will work, but the "?:"-statement makes the code hardly readable. The following code extract will show the advantage of using the imgNew instantiator:
class Foo{ public: Foo(...,Depth eDepth,...): poImage(imgNew(eDepth,...)){ } private: ImgBase *poImage; };
The readability of the code is much better.
d | depth of the image that should be created |
params | struct containing all neccessary parameters like: size: size of the new image fmt: format of the new image channels: number of channels (of an formatMatrix-type image) roi: ROI rectangle of the new image |
|
inline |
creates a new Img (see the above function for more details)
|
inline |
creates a new Img (see the above function for more details)
|
inline |
creates a new Img (see the above function for more details)