|
| HoughLineDetector (float dRho=0.1, float dR=10, const utils::Range32f &rRange=utils::Range32f(0,::sqrt(640 *640+480 *480)), float rInhibitionRange=10, float rhoInhibitionRange=0.3, bool gaussianInhibition=true, bool blurHoughSpace=true, bool dilateEntries=true, bool blurredSampling=false) |
| Create a new HoughLineDetectorInstance. More...
|
|
| ~HoughLineDetector () |
|
void | add (const utils::Point &p) |
| adds a new point More...
|
|
void | add (const std::vector< utils::Point > &ps) |
| adds new points More...
|
|
void | add (const utils::Point32f &p) |
| adds a new point More...
|
|
void | add (const std::vector< utils::Point32f > &ps) |
| adds new points More...
|
|
template<class T > |
void | add (const math::FixedColVector< T, 2 > &p) |
| adds a new point More...
|
|
template<class T > |
void | add (const std::vector< const math::FixedColVector< T, 2 > > &ps) |
| adds new points More...
|
|
void | add (const core::Img8u &binaryImage) |
| adds all non zero pixels of the given binary image More...
|
|
const core::Img32s & | getImage () const |
| returns current hough-table image More...
|
|
const core::Img32f & | getInhibitionMap () const |
| returns current gaussian inhibition map More...
|
|
void | reset () |
| sets all hough table entries to 0 More...
|
|
std::vector< math::StraightLine2D > | getLines (int max, bool resetAfterwards=true) |
| detects up to max lines More...
|
|
std::vector< math::StraightLine2D > | getLines (int max, std::vector< float > &significances, bool resetAfterwards=true) |
| detects up to max lines and pushes the line significances into given destination vector More...
|
|
virtual | ~Configurable () |
| virtual destructor More...
|
|
| Configurable (const Configurable &other) |
| Copy constructor. More...
|
|
Configurable & | operator= (const Configurable &other) |
| Assignment operator. More...
|
|
void | setConfigurableID (const std::string &ID) |
| sets the ID of this configurable More...
|
|
const std::string & | getConfigurableID () const |
| returns the configurables static ID More...
|
|
bool | isOrderedFlagSet () const |
| returns whether the ordered flag is set More...
|
|
void | deactivateProperty (const std::string &pattern) |
| adds an additional deativation pattern More...
|
|
void | deleteDeactivationPattern (const std::string &pattern) |
| removed a formerly added deactivation pattern More...
|
|
std::vector< std::string > | getPropertyListWithoutDeactivated () const |
| this returns a filtered list of properties (using all filters added by deactivateProperty) More...
|
|
virtual void | adaptProperty (const std::string &name, const std::string &newType, const std::string &newInfo, const std::string &newToolTip) |
| this function can be used to adapt a specific property afterwards More...
|
|
void | registerCallback (const Callback &cb) |
| add a callback for changed properties More...
|
|
void | removedCallback (const Callback &cb) |
| removes a callback that was registered before More...
|
|
void | syncChangesTo (Configurable *others, int num=1) |
| this can be used to let this instance also apply property changes to others More...
|
|
virtual void | setPropertyValue (const std::string &propertyName, const Any &value) |
| sets a property value More...
|
|
virtual std::vector< std::string > | getPropertyList () const |
| returns a list of All properties, that can be set using setProperty More...
|
|
virtual bool | supportsProperty (const std::string &propertyName) const |
| base implementation for property check (seaches in the property list) More...
|
|
virtual void | saveProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC) const |
| writes all available properties into a file More...
|
|
virtual void | loadProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC) |
| reads a camera config file from disc More...
|
|
virtual std::string | getPropertyType (const std::string &propertyName) const |
| get type of property More...
|
|
virtual std::string | getPropertyInfo (const std::string &propertyName) const |
| get information of a properties valid values More...
|
|
virtual Any | getPropertyValue (const std::string &propertyName) const |
| returns the current value of a property or a parameter More...
|
|
virtual std::string | getPropertyToolTip (const std::string &propertyName) const |
| returns the tooltip description for a given property More...
|
|
virtual int | getPropertyVolatileness (const std::string &propertyName) const |
| Returns whether this property may be changed internally. More...
|
|
|
void | prepare_all () |
|
void | prepare (float dRho, float dR, const utils::Range32f &rRange, float rInhibitionRange, float rhoInhibitionRange, bool gaussianInhibition=true, bool blurHoughSpace=true, bool dilateEntries=true, bool blurredSampling=false) |
| initializes the HoughLineDetector More...
|
|
float | r (float rho, float x, float y) const |
| internal utility function More...
|
|
int | getX (float rho) const |
| internal utility function More...
|
|
int | getY (float r) const |
| internal utility function More...
|
|
float | getRho (int x) const |
| internal utility function More...
|
|
float | getR (int y) const |
| internal utility function More...
|
|
void | incLut (float rho, float r) |
| internal utility function More...
|
|
void | incLutBlurred (float rho, float r) |
| internal utility function More...
|
|
int & | cyclicLUT (int x, int y) |
| internal utility function More...
|
|
void | apply_inhibition (const utils::Point &p) |
| internal utility function More...
|
|
void | add_intern (float x, float y) |
| internal utility function More...
|
|
void | add_intern2 (float x, float y) |
| internal utility function More...
|
|
void | blur_hough_space_if_necessary () |
| internal utility function More...
|
|
|
typedef Function< void, const Property & > | Callback |
| Function type for changed properties. More...
|
|
static std::string | create_default_ID (const std::string &prefix) |
| this function can be used in subclasses to create a default ID More...
|
|
static Configurable * | get (const std::string &id) |
| returns configurable by given ID More...
|
|
static void | register_configurable_type (const std::string &classname, Function< Configurable * > creator) |
| registers a configurable type More...
|
|
static std::vector< std::string > | get_registered_configurables () |
| returns a list of all registered configurable classnames More...
|
|
static Configurable * | create_configurable (const std::string &classname) |
| creates a configurable by given name More...
|
|
static const std::vector< std::string > | EMPTY_VEC |
| used as shortcut – just an empty vector of std::strings More...
|
|
void | addProperty (const std::string &name, const std::string &type, const std::string &info, const Any &value=Any(), const int volatileness=0, const std::string &tooltip=std::string()) |
| This can be used by derived classes to store supported properties in the internal list. More...
|
|
void | addChildConfigurable (Configurable *configurable, const std::string &childPrefix="") |
| This adds another configurable as child. More...
|
|
void | removeChildConfigurable (Configurable *configurable) |
| removes the given child configurable More...
|
|
Property & | prop (const std::string &propertyName) |
| this CAN be used e.g. to store a property value in internal property-list More...
|
|
const Property & | prop (const std::string &propertyName) const |
| this CAN be used e.g. to store a property value in internal property-list More...
|
|
| Configurable (const std::string &ID="", bool ordered=true) |
| create this configurable with given ID More...
|
|
void | call_callbacks (const std::string &propertyName, const Configurable *caller) const |
| calls all registered callbacks More...
|
|
std::vector< Callback > | callbacks |
| internally managed list of callbacks More...
|
|
LineDetection class using hough-space line detection
Algorithms
Image lines (of infinite length) can be described by a tuple (rho,r) and the line equation . Each pixel (x,y) belongs potentially to a all lines (rho,r) where this equation is true. Internally, the space of possible lines (sometimes referred a the hough-space) is sampled (internally we use an instance of core::Img32s). Rho is mapped to the x-axis (x=0 -> rho=0, x=width-1 -> rho = 2*M_PI) and r is mapped to the y-axis (y=0 -> r=minR, y=height-1 -> r=maxR). So the size of the internal hough-space becomes 2*M_PI/dRho x (rRange.max-rRange.min)/dR.
When a new border pixel (x,y) is added, the probability of each potential line that intersects (x,y) is increased. Technically this is performed by computing r(rho) for all possible values rho (all samples) with the formula for r above which leads to values (rho,r) which's hough-space entries are increased by one. The best line matches can be computed from the maxima in the resulting hough space.
Optimizations
To enhance line detection performance, the HoughLineDetector provides a set of optimization approaches:
Local inhibition around detected lines
As a single image line, might result in 2 or even more lines in the hough-space (because of spacial noise in the pixels detection procedure), the hough-space is locally inhibited around already detected lines. The amount of this inhibition procedure can be set by the constructor parameters (rInhibitionRange and rhoInhibitionRange).
Gaussian inhibition
Sometimes hard borders of the inhibition sub-window lead to random 2nd and 3rd detected line values. To stabilize this, inhibition can be set up to be 'gaussian-blurred', which means, that hough-table entries that are very close to already detected lines are nearly removed completely and those that are also in the inhibition sub-rect but some pixels away from the detected line center are inhibited less.
Gaussian inhibition
Resulting from the sampling procedure of both, that actual image space and the hough-space, entries in the hough-space might have hard borders or even gaps. To avoid this, three different optimization techniques are provided, which can all be combined.
Blurring the hough space
This means, that the hough-space is simply blurred using a 3x3 linear gaussian filter. This optimization provides much more stable results, but it also entails a higher computational expense.
Dilation of pixel entries
If this optimization is activated, no only the given pixel (x,y) is added internally, but also it's 4 direct neighbour pixels. This also leads to a kind of blurred hough table
Blurred sampling of lines
This optimization changes the line-sampling procedure. When a line is sampled for all rho-values using r = x cos(rho) + y sin(rho), not only the resulting pixel p in the hough table is increased, but also the pixel above, and the pixel below (actually, the exactly computed pixel p is increased by 2 and it's upper and lower neighbour's are increased by one). This again leads to a blurring effect. however, the other two optimzations provides better results. It's worth mention, that this optimization's additional computational expense is low in comparison to the other two optizations.