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

The ImgParams class stores all image parameters \. More...

#include <ImgParams.h>

List of all members.

Public Member Functions

 ImgParams ()
 creates a null ImgParams object
 ImgParams (const ImgParams &params)
 copy constructor
 ImgParams (const utils::Size &size, int channels, const utils::Rect &roi=utils::Rect::null)
 creates an ImgParams object with specified size, channels, roi and formatMatrix
 ImgParams (const utils::Size &size, format fmt, const utils::Rect &roi=utils::Rect::null)
 creates an ImgParams object with specified size, channels, roi and format
 ImgParams (const utils::Size &size, int channels, format fmt, const utils::Rect &roi=utils::Rect::null)
 creates an ImgParams object with all given parameters
 ImgParams (int width, int height, format fmt, int roiX=0, int roiY=0, int roiWidth=0, int roiHeight=0)
 creates an ImgParams object with specified size, format and roi given as POD-Types
 ImgParams (int width, int height, int channels, int roiX=0, int roiY=0, int roiWidth=0, int roiHeight=0)
 creates an ImgParams object with specified size, channel and roi given as POD-Types
 ImgParams (int width, int height, int channels, format fmt, int roiX=0, int roiY=0, int roiWidth=0, int roiHeight=0)
 creates an ImgParams object with ALL possible parameters
bool isNull () const
 checks wether the object instance is null, i.e. all elements are zero
bool operator!= (const ImgParams &other) const
 returns !(*this==other)
bool operator== (const ImgParams &other) const
 test is all parameters (size, roi, channels, format) are identical
void setSize (const utils::Size &size)
 sets the size to the current value (and resets the roi to null)
void setFormat (format fmt)
 sets the format to the given format (the channel count is adapted on demand)
void setChannels (int channels)
 sets the channels to the given channel count (format is set to "formatMatrix" on demand)
void setROIOffset (const utils::Point &offset)
 sets the image ROI offset to the given value
void setROISize (const utils::Size &roisize)
 sets the image ROI size to the given value
void setROI (const utils::Point &offset, const utils::Size &roisize)
 set both image ROI offset and size
void setROI (const utils::Rect &roi)
 sets the image ROI to the given rectangle
void setROIOffsetAdaptive (const utils::Point &offset)
 checks, eventually adapts and finally sets the image ROI offset
void setROISizeAdaptive (const utils::Size &size)
 checks, eventually adapts and finally sets the image ROI size
void setROIAdaptive (const utils::Rect &r)
 as setROI, but if checks for negative parameters
utils::RectadaptROI (utils::Rect &roi) const
 adapt given ROI, such that it fits for the current ImgParams
bool hasFullROI () const
 returns ROISize == ImageSize
void setFullROI ()
 sets the ROI to 0,0,image-width,image-height
const utils::SizegetSize () const
 returns the objects size
int getChannels () const
 returns the objects channel count
format getFormat () const
 returns the object format
const utils::RectgetROI () const
 returns the objects ROI rect
void getROI (utils::Point &offset, utils::Size &size) const
 copies the roi parameters into the given structs offset and size
const utils::Point getROIOffset () const
 returns the objects ROI offset
const utils::Size getROISize () const
 returns the objects ROI size
int getWidth () const
 returns the objects image width
int getHeight () const
 return the objects image height
int getPixelOffset () const
 returns ROI-dependent pixel offset, to address the upper left ROI pixel
int getROIWidth () const
 returns the ROI width of the object
int getROIHeight () const
 returns the ROI height of the object
int getROIXOffset () const
 returns the ROI X-Offset of the object
int getROIYOffset () const
 returns the ROI Y-Offset of the object
int getDim () const
 returns the count of image pixels (width*height)
int getROIDim () const
 returns the count of ROI pixels ( ROI_width*ROI_height )

Static Public Attributes

static const ImgParams null
 as default size=(0,0), channels=0, format=matrix, roi=(0,0,0,0)

Private Member Functions

void setup (const utils::Size &size, format fmt, int channels, const utils::Rect &roi)
 initialisation function

Private Attributes

utils::Size m_oSize
 image size
int m_iChannels
 image channel count
format m_eFormat
 image format (formatRGB, formatMatrix, ...)
utils::Rect m_oROI
 image roi

Detailed Description

The ImgParams class stores all image parameters \.

This class offers an encapsulation of all Img parameters

The class helps to create image processing classes getting certain image parameters. This parameters can now directly be aquired from an ImgBase object. In addition to this, except to the ImgBases underlying depth (which is commited to the depth of the underlying Img object) Images can be made compatible by calling imageA.setParams(imageB.getParams())


Constructor & Destructor Documentation

creates a null ImgParams object

See also:
setup
null
icl::core::ImgParams::ImgParams ( const ImgParams params) [inline]

copy constructor

See also:
setup
icl::core::ImgParams::ImgParams ( const utils::Size size,
int  channels,
const utils::Rect roi = utils::Rect::null 
) [inline]

creates an ImgParams object with specified size, channels, roi and formatMatrix

See also:
setup
icl::core::ImgParams::ImgParams ( const utils::Size size,
format  fmt,
const utils::Rect roi = utils::Rect::null 
)

creates an ImgParams object with specified size, channels, roi and format

See also:
setup
icl::core::ImgParams::ImgParams ( const utils::Size size,
int  channels,
format  fmt,
const utils::Rect roi = utils::Rect::null 
) [inline]

creates an ImgParams object with all given parameters

Note that channels and format are not independent. Hence, if the given channel count is not compatible to the given format, an exception is thrown.

See also:
setup
icl::core::ImgParams::ImgParams ( int  width,
int  height,
format  fmt,
int  roiX = 0,
int  roiY = 0,
int  roiWidth = 0,
int  roiHeight = 0 
)

creates an ImgParams object with specified size, format and roi given as POD-Types

channel count is adapted to the given format

See also:
setup
icl::core::ImgParams::ImgParams ( int  width,
int  height,
int  channels,
int  roiX = 0,
int  roiY = 0,
int  roiWidth = 0,
int  roiHeight = 0 
)

creates an ImgParams object with specified size, channel and roi given as POD-Types

The format is set to "formatMatrix"

See also:
setup
icl::core::ImgParams::ImgParams ( int  width,
int  height,
int  channels,
format  fmt,
int  roiX = 0,
int  roiY = 0,
int  roiWidth = 0,
int  roiHeight = 0 
)

creates an ImgParams object with ALL possible parameters

Note that channels and format are not independent. Hence, if the given channel count is not compatible to the given format, an exception is thrown.

See also:
setup

Member Function Documentation

adapt given ROI, such that it fits for the current ImgParams

See also:
setROIAdaptive
int icl::core::ImgParams::getChannels ( ) const [inline]

returns the objects channel count

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

returns the count of image pixels (width*height)

returns the object format

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

return the objects image height

int icl::core::ImgParams::getPixelOffset ( ) const [inline]

returns ROI-dependent pixel offset, to address the upper left ROI pixel

const utils::Rect& icl::core::ImgParams::getROI ( ) const [inline]

returns the objects ROI rect

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

copies the roi parameters into the given structs offset and size

int icl::core::ImgParams::getROIDim ( ) const [inline]

returns the count of ROI pixels ( ROI_width*ROI_height )

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

returns the ROI height of the object

returns the objects ROI offset

returns the objects ROI size

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

returns the ROI width of the object

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

returns the ROI X-Offset of the object

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

returns the ROI Y-Offset of the object

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

returns the objects size

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

returns the objects image width

bool icl::core::ImgParams::hasFullROI ( ) const [inline]

returns ROISize == ImageSize

bool icl::core::ImgParams::isNull ( ) const [inline]

checks wether the object instance is null, i.e. all elements are zero

bool icl::core::ImgParams::operator!= ( const ImgParams other) const [inline]

returns !(*this==other)

bool icl::core::ImgParams::operator== ( const ImgParams other) const

test is all parameters (size, roi, channels, format) are identical

void icl::core::ImgParams::setChannels ( int  channels)

sets the channels to the given channel count (format is set to "formatMatrix" on demand)

sets the format to the given format (the channel count is adapted on demand)

sets the ROI to 0,0,image-width,image-height

void icl::core::ImgParams::setROI ( const utils::Point offset,
const utils::Size roisize 
)

set both image ROI offset and size

This function evaluates if the new offset is inside of the image, as well as if the resulting roi does fit into the image.

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

sets the image ROI to the given rectangle

as setROI, but if checks for negative parameters

While the methods setROI, setROIOffset and setROISize directly set the images ROI from the given arguments (if possible), the following methods adapt the ROI parameters to assure a valid ROI. Negative values are interpreted relative to the whole image size resp. the lower right corner of the image.

E.g. an offset (5,5) with size (-10,-10) sets the ROI to the inner sub image with a 5-pixel margin. offset(-5,-5) and size (5,5) sets the ROI to the lower right 5x5 corner.

sets the image ROI offset to the given value

If the offset is not inside of the image or the new offset causes the roi not to fit into the image, nothing is done, and an exception is thrown.

checks, eventually adapts and finally sets the image ROI offset

void icl::core::ImgParams::setROISize ( const utils::Size roisize)

sets the image ROI size to the given value

If the new roi size causes the roi not to fit into the image, nothing is done and an exception is thrown

checks, eventually adapts and finally sets the image ROI size

sets the size to the current value (and resets the roi to null)

void icl::core::ImgParams::setup ( const utils::Size size,
format  fmt,
int  channels,
const utils::Rect roi 
) [private]

initialisation function

The initialisation function does all the magic that is necessary to setup all parameters correctly. There are two issues, that must be treated in a special way: 1. size must be positive in [0,inf) x [0,inf) 2. set up the format and channel count correctly 3. ensure, that the roi has a valid size and position

Format and Channel Count

The parameters format and channel count depend on each other. The channel count is fixed and well defined for all allowed formats except "formatMatrix", where the channel count is arbitrary including zero. So, if the given format distincts from formatMatrix, the given channel count is disobeyed and the objects channel count is set to the channel count associated with the given format (e.g. the "formatRGB" has three channels). The association is performed by the global icl-namespace function getChannelsOfFormat (see the functions documentation for more details. If the given format is "formatMatrix", then the channel count is checked to be positive (in [0,inf)) to avoid errors, that would occur, if e.g. -5 channels are allocated at runtime.

Ensure a Valid ROI Size

In total, there are three problems, that need to be tackled when the ROI is set.

  • Check if the given roi is null: if the given roi is null (this means the rect has offset (0,0) and size (0,0)), then the objects ROI is set up to cover the whole image rect (offset (0,0) and size (image-width,image-height)). If it is not null, the following two issues must be regarded.
  • Check if the given offset is inside of the image: This should be self-evident. If the offset is outside the image rect, it is set to (0,0), and furthermore a specific exception is thrown.
  • Check if the given roi size is valid: This can be devided into two parts: 1. The ROI size must be positive (in [0,inf) x [0,inf)). If not, the roi is set to null (whole image) and an error is thrown. 2. The ROI must fit into the image. Otherwise the ROI is set to null (whole image) and an error is thrown.

Member Data Documentation

image format (formatRGB, formatMatrix, ...)

image channel count

image roi

image size

as default size=(0,0), channels=0, format=matrix, roi=(0,0,0,0)


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