Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Attributes
icl::cv::ContourDetector Class Reference

The ContourDetector extracts all contours of a given image. More...

#include <ContourDetector.h>

Inheritance diagram for icl::cv::ContourDetector:
icl::utils::Uncopyable

List of all members.

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

Detailed Description

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

Contour Hierarchy

The ContourDetector can be set up to also extract a countour hierarchy.

Algorithms

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.


Member Enumeration Documentation

contour tracing algorithm used

Enumerator:
Fast 

fast contour detection algorithm (using 4-point neighbourhood)

Accurate 

accurate contour detection algorithm (using 8-point neighborhood)

AccurateWithHierarchy 

same as Accurate, but with Hierarchy estimation


Constructor & Destructor Documentation

Parameters:
theshthreshold for creating the binary image
hierarchyshows if the relationship of the contours should be calculated

Member Function Documentation

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


Member Data Documentation

internal data pointer


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