|
| ImgParams () |
| creates a null ImgParams object More...
|
|
| ImgParams (const ImgParams ¶ms) |
| copy constructor More...
|
|
| 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 More...
|
|
| 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 More...
|
|
| ImgParams (const utils::Size &size, int channels, format fmt, const utils::Rect &roi=utils::Rect::null) |
| creates an ImgParams object with all given parameters More...
|
|
| 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 More...
|
|
| 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 More...
|
|
| 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 More...
|
|
bool | isNull () const |
| checks wether the object instance is null, i.e. all elements are zero More...
|
|
bool | operator!= (const ImgParams &other) const |
| returns !(*this==other) More...
|
|
bool | operator== (const ImgParams &other) const |
| test is all parameters (size, roi, channels, format) are identical More...
|
|
void | setSize (const utils::Size &size) |
| sets the size to the current value (and resets the roi to null) More...
|
|
void | setFormat (format fmt) |
| sets the format to the given format (the channel count is adapted on demand) More...
|
|
void | setChannels (int channels) |
| sets the channels to the given channel count (format is set to "formatMatrix" on demand) More...
|
|
void | setROIOffset (const utils::Point &offset) |
| sets the image ROI offset to the given value More...
|
|
void | setROISize (const utils::Size &roisize) |
| sets the image ROI size to the given value More...
|
|
void | setROI (const utils::Point &offset, const utils::Size &roisize) |
| 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 offset More...
|
|
void | setROISizeAdaptive (const utils::Size &size) |
| checks, eventually adapts and finally sets the image ROI size More...
|
|
void | setROIAdaptive (const utils::Rect &r) |
| as setROI, but if checks for negative parameters More...
|
|
utils::Rect & | adaptROI (utils::Rect &roi) const |
| adapt given ROI, such that it fits for the current ImgParams More...
|
|
bool | hasFullROI () const |
| returns ROISize == ImageSize More...
|
|
void | setFullROI () |
| sets the ROI to 0,0,image-width,image-height More...
|
|
const utils::Size & | getSize () const |
| returns the objects size More...
|
|
int | getChannels () const |
| returns the objects channel count More...
|
|
format | getFormat () const |
| returns the object format More...
|
|
const utils::Rect & | getROI () const |
| returns the objects ROI rect More...
|
|
void | getROI (utils::Point &offset, utils::Size &size) const |
| copies the roi parameters into the given structs offset and size More...
|
|
const utils::Point | getROIOffset () const |
| returns the objects ROI offset More...
|
|
const utils::Size | getROISize () const |
| returns the objects ROI size More...
|
|
int | getWidth () const |
| returns the objects image width More...
|
|
int | getHeight () const |
| return the objects image height More...
|
|
int | getPixelOffset () const |
| returns ROI-dependent pixel offset, to address the upper left ROI pixel More...
|
|
int | getROIWidth () const |
| returns the ROI width of the object More...
|
|
int | getROIHeight () const |
| returns the ROI height of the object More...
|
|
int | getROIXOffset () const |
| returns the ROI X-Offset of the object More...
|
|
int | getROIYOffset () const |
| returns the ROI Y-Offset of the object More...
|
|
int | getDim () const |
| returns the count of image pixels (width*height) More...
|
|
int | getROIDim () const |
| returns the count of ROI pixels ( ROI_width*ROI_height ) More...
|
|
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())
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:
- size must be positive in [0,inf) x [0,inf)
- set up the format and channel count correctly
- 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:
- 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.
- The ROI must fit into the image. Otherwise the ROI is set to null (whole image) and an error is thrown.