Image Component Library (ICL)
|
unary operators that work on each pixels neighborhood \ More...
#include <NeighborhoodOp.h>
Public Member Functions | |
virtual | ~NeighborhoodOp () |
Destructor. | |
bool | computeROI (const core::ImgBase *poSrc, utils::Point &oROIoffset, utils::Size &oROIsize) |
compute neccessary ROI offset and size | |
virtual void | applyMT (const core::ImgBase *operand1, core::ImgBase **dst, unsigned int nThreads) |
*NEW* apply function for multithreaded filtering (reimplemented here for special roi handling!) | |
const utils::Size & | getMaskSize () const |
const utils::Point & | getAnchor () const |
const utils::Point & | getROIOffset () const |
Protected Member Functions | |
NeighborhoodOp () | |
NeighborhoodOp (const utils::Size &size) | |
void | setMask (const utils::Size &size) |
void | setMask (const utils::Size &size, const utils::Point &anchor) |
void | setROIOffset (const utils::Point &offs) |
virtual bool | prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc) |
prepare filter operation: ensure compatible image format and size | |
virtual bool | prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc, core::depth eDepht) |
prepare filter operation: as above, but with depth parameter | |
virtual utils::Size | adaptSize (const utils::Size &size) |
this function can be reimplemented e.g to enshure an odd mask width and height | |
Protected Attributes | |
utils::Size | m_oMaskSize |
TODO: later private with getter and setter functions. | |
utils::Point | m_oAnchor |
anchor of filter mask | |
utils::Point | m_oROIOffset |
to-be-used ROI offset for source image |
unary operators that work on each pixels neighborhood \
TODO:: check!! The NeighborhoodOp class builds a base class for unary operations employing a filter mask which is moved over the ROI of the source image(s), e.g. convolution filters use some convolution masks. To this end the class provides members to store the size and anchor of the filter mask.
Special care has to be taken, when applying a filter mask to the border of an image, e.g. in case of full-image ROI. In this case the filter might access undefined pixel values outside the image, actually causing a segfault in most cases.
Hence, the used ROI size of the source image is shrinked if neccessary, such that the filter mask always fits into the image, when moved over the ROI. For this purpose the method adaptROI is provided, which computes the to-be-used ROI. The ROI of the source image is not actually changed, which makes the filter operation thread safe, because simultaneous operations running on the source image within different threads do not interfere.
virtual icl::filter::NeighborhoodOp::~NeighborhoodOp | ( | ) | [inline, virtual] |
Destructor.
icl::filter::NeighborhoodOp::NeighborhoodOp | ( | ) | [inline, protected] |
icl::filter::NeighborhoodOp::NeighborhoodOp | ( | const utils::Size & | size | ) | [inline, protected] |
virtual utils::Size icl::filter::NeighborhoodOp::adaptSize | ( | const utils::Size & | size | ) | [inline, protected, virtual] |
this function can be reimplemented e.g to enshure an odd mask width and height
E.g. some implementations of Neighborhood-operation could demand odd or even mask size parameters. In this case, this function can be implemented in another way. (Example: MedianOp)
size | size to ajust |
Reimplemented in icl::filter::MedianOp.
virtual void icl::filter::NeighborhoodOp::applyMT | ( | const core::ImgBase * | operand1, |
core::ImgBase ** | dst, | ||
unsigned int | nThreads | ||
) | [virtual] |
*NEW* apply function for multithreaded filtering (reimplemented here for special roi handling!)
Reimplemented from icl::filter::UnaryOp.
bool icl::filter::NeighborhoodOp::computeROI | ( | const core::ImgBase * | poSrc, |
utils::Point & | oROIoffset, | ||
utils::Size & | oROIsize | ||
) |
compute neccessary ROI offset and size
This functions computes the to-be-used ROI for the source image, such that the filter mask of given size (oMaskSize) fits everywhere into the image if placed arbitrarily within the ROI. The original ROI of the source image is not changed, instead the adapted ROI is returned in parameters oROIsize and oROIoffset.
poSrc | image whose ROI is adapted |
oROIoffset | new ROI offset |
oROIsize | new ROI size |
const utils::Point& icl::filter::NeighborhoodOp::getAnchor | ( | ) | const [inline] |
const utils::Size& icl::filter::NeighborhoodOp::getMaskSize | ( | ) | const [inline] |
Reimplemented in icl::filter::MorphologicalOp.
const utils::Point& icl::filter::NeighborhoodOp::getROIOffset | ( | ) | const [inline] |
virtual bool icl::filter::NeighborhoodOp::prepare | ( | core::ImgBase ** | ppoDst, |
const core::ImgBase * | poSrc | ||
) | [protected, virtual] |
prepare filter operation: ensure compatible image format and size
Reimplemented from icl::filter::UnaryOp.
virtual bool icl::filter::NeighborhoodOp::prepare | ( | core::ImgBase ** | ppoDst, |
const core::ImgBase * | poSrc, | ||
core::depth | eDepht | ||
) | [protected, virtual] |
prepare filter operation: as above, but with depth parameter
Reimplemented from icl::filter::UnaryOp.
void icl::filter::NeighborhoodOp::setMask | ( | const utils::Size & | size | ) | [inline, protected] |
void icl::filter::NeighborhoodOp::setMask | ( | const utils::Size & | size, |
const utils::Point & | anchor | ||
) | [inline, protected] |
void icl::filter::NeighborhoodOp::setROIOffset | ( | const utils::Point & | offs | ) | [inline, protected] |
utils::Point icl::filter::NeighborhoodOp::m_oAnchor [protected] |
anchor of filter mask
utils::Size icl::filter::NeighborhoodOp::m_oMaskSize [protected] |
TODO: later private with getter and setter functions.
size of filter mask
to-be-used ROI offset for source image