Image Component Library (ICL)
|
The ContourDetector extracts all contours of a given image. More...
#include <ContourDetector.h>
Public Types | |
enum | Algorithm { Fast, Accurate, AccurateWithHierarchy } |
contour tracing algorithm used More... | |
Public Member Functions | |
ContourDetector (const icl8u thresh=128, Algorithm a=Fast) | |
virtual | ~ContourDetector () |
void | drawAllContours (core::ImgBase *img, const icl64f &value) |
const std::vector< Contour > & | detect (const core::ImgBase *image) |
const std::vector< Contour > & | detect (core::Img8u &image) |
void | setThreshold (const icl8u &threshold) |
sets new binarization threshold | |
void | setAlgorithm (Algorithm a) |
sets whether a contour hierarchy is created | |
Private Attributes | |
Data * | m_data |
internal data pointer |
The ContourDetector extracts all contours of a given image.
Internally, the implementation works on binary images only, but a compatiblity layer is provided that allows for working on arbitraryly-typed images by internally converting the input image before the compuation takes place. The algorithms alters the values of the input image for performance reasons. If a const image is passed to the ContourDetector::detect method, the image is copied/converted before
The ContourDetector can be set up to also extract a countour hierarchy.
Internally 2 different contour tracing algorithms are implemented. While the "Fast" method uses a 4-point neighbourhood, the Accurate method uses a 8-point neighborhood an can also optionally be used to obtain a region hierarchy. The fast method uses its own memory allocator to improve runtime performance.
icl::cv::ContourDetector::ContourDetector | ( | const icl8u | thresh = 128 , |
Algorithm | a = Fast |
||
) |
thesh | threshold for creating the binary image |
hierarchy | shows if the relationship of the contours should be calculated |
virtual icl::cv::ContourDetector::~ContourDetector | ( | ) | [virtual] |
const std::vector<Contour>& icl::cv::ContourDetector::detect | ( | const core::ImgBase * | image | ) |
const std::vector<Contour>& icl::cv::ContourDetector::detect | ( | core::Img8u & | image | ) |
void icl::cv::ContourDetector::drawAllContours | ( | core::ImgBase * | img, |
const icl64f & | value | ||
) |
sets whether a contour hierarchy is created
void icl::cv::ContourDetector::setThreshold | ( | const icl8u & | threshold | ) |
sets new binarization threshold
Data* icl::cv::ContourDetector::m_data [private] |
internal data pointer