Image Component Library (ICL)
|
The ImgParams class stores all image parameters \. More...
#include <ImgParams.h>
Public Member Functions | |
ImgParams () | |
creates a null ImgParams object | |
ImgParams (const ImgParams ¶ms) | |
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::Rect & | adaptROI (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::Size & | getSize () const |
returns the objects size | |
int | getChannels () const |
returns the objects channel count | |
format | getFormat () const |
returns the object format | |
const utils::Rect & | getROI () 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 |
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())
icl::core::ImgParams::ImgParams | ( | ) | [inline] |
icl::core::ImgParams::ImgParams | ( | const ImgParams & | params | ) | [inline] |
copy constructor
icl::core::ImgParams::ImgParams | ( | const utils::Size & | size, |
int | channels, | ||
const utils::Rect & | roi = utils::Rect::null |
||
) | [inline] |
icl::core::ImgParams::ImgParams | ( | const utils::Size & | size, |
format | fmt, | ||
const utils::Rect & | roi = utils::Rect::null |
||
) |
icl::core::ImgParams::ImgParams | ( | const utils::Size & | size, |
int | channels, | ||
format | fmt, | ||
const utils::Rect & | roi = utils::Rect::null |
||
) | [inline] |
icl::core::ImgParams::ImgParams | ( | int | width, |
int | height, | ||
format | fmt, | ||
int | roiX = 0 , |
||
int | roiY = 0 , |
||
int | roiWidth = 0 , |
||
int | roiHeight = 0 |
||
) |
icl::core::ImgParams::ImgParams | ( | int | width, |
int | height, | ||
int | channels, | ||
int | roiX = 0 , |
||
int | roiY = 0 , |
||
int | roiWidth = 0 , |
||
int | roiHeight = 0 |
||
) |
icl::core::ImgParams::ImgParams | ( | int | width, |
int | height, | ||
int | channels, | ||
format | fmt, | ||
int | roiX = 0 , |
||
int | roiY = 0 , |
||
int | roiWidth = 0 , |
||
int | roiHeight = 0 |
||
) |
utils::Rect& icl::core::ImgParams::adaptROI | ( | utils::Rect & | roi | ) | const |
adapt given ROI, such that it fits for the current ImgParams
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)
format icl::core::ImgParams::getFormat | ( | ) | const [inline] |
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
const utils::Point icl::core::ImgParams::getROIOffset | ( | ) | const [inline] |
returns the objects ROI offset
const utils::Size icl::core::ImgParams::getROISize | ( | ) | const [inline] |
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)
void icl::core::ImgParams::setFormat | ( | format | fmt | ) |
sets the format to the given format (the channel count is adapted on demand)
void icl::core::ImgParams::setFullROI | ( | ) | [inline] |
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
void icl::core::ImgParams::setROIAdaptive | ( | const utils::Rect & | r | ) |
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.
void icl::core::ImgParams::setROIOffset | ( | const utils::Point & | offset | ) |
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.
void icl::core::ImgParams::setROIOffsetAdaptive | ( | const utils::Point & | offset | ) |
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
void icl::core::ImgParams::setROISizeAdaptive | ( | const utils::Size & | size | ) |
checks, eventually adapts and finally sets the image ROI size
void icl::core::ImgParams::setSize | ( | const utils::Size & | 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
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.
In total, there are three problems, that need to be tackled when the ROI is set.
format icl::core::ImgParams::m_eFormat [private] |
image format (formatRGB, formatMatrix, ...)
int icl::core::ImgParams::m_iChannels [private] |
image channel count
utils::Rect icl::core::ImgParams::m_oROI [private] |
image roi
utils::Size icl::core::ImgParams::m_oSize [private] |
image size
const ImgParams icl::core::ImgParams::null [static] |
as default size=(0,0), channels=0, format=matrix, roi=(0,0,0,0)