#include <hough_transform2.h>
Collaboration diagram for mimas::find_line< ImageIteratorSource >:
Public Member Functions | |
segment< point > | polar_to_castesian (double theta, double r) |
find_line (ImageIteratorSource ul, ImageIteratorSource lr, double thresh_factor=.7, int orientationDivision=180) | |
image< unsigned char > | exec (void) |
std::vector< segment< point > > | getLines (void) |
Public Attributes | |
std::vector< segment< point > > | lines |
Protected Member Functions | |
void | hough (void) |
void | findMax (void) |
void | findLine (void) |
image< unsigned char > | displayLine (void) |
Protected Attributes | |
int | nbOrientationDiv |
double | thresh |
double | maxVal |
ImageIteratorSource | ul |
ImageIteratorSource | lr |
int | w |
int | h |
int | imageDiagonalSize |
int | center_x |
int | center_y |
Array2D | parameterSpace |
Works on sub-images thanks to image iterators
Take as input an image< of not a composed type> (i.e. not rgba< unsigned char >) Pixels which value is different from 0 are considered as being candidate for belonging to a line.
after h.exec() has been executed results are stored in std::vector< segment< point > > lines
This was originally implemented as a short exercice for myself to understand the Hough transform. As such the value of the code is quite poor however it might allow other people to understand the Hough transform with a simple implementation as well as providing them with a starting point for further experimentations.
It is thus possible to continue improving this class adding other high-level as well as low level functionalities. A bit more of work is still needed to put it in the include of mimas. Need to be tested for color images ...
Check what can be borrowed from hough_transform one of the first improvement is to locate localy a maximum when adjacent bins have number of hits above the threshold
Have a look to the gandalf implementation of the fast Hough transform
at the moment a sample code using this class would look like:
find_line< image< int >::ImageIterator > h(image.ul(), image.lr() , .7, 145); display << h.exec();
Definition at line 67 of file hough_transform2.h.
mimas::find_line< ImageIteratorSource >::find_line | ( | ImageIteratorSource | ul, | |
ImageIteratorSource | lr, | |||
double | thresh_factor = .7 , |
|||
int | orientationDivision = 180 | |||
) | [inline] |
Definition at line 168 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::center_x, mimas::find_line< ImageIteratorSource >::center_y, mimas::find_line< ImageIteratorSource >::h, mimas::find_line< ImageIteratorSource >::thresh, and mimas::find_line< ImageIteratorSource >::w.
void mimas::find_line< ImageIteratorSource >::hough | ( | void | ) | [inline, protected] |
Definition at line 87 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::center_x, mimas::find_line< ImageIteratorSource >::center_y, mimas::find_line< ImageIteratorSource >::h, mimas::find_line< ImageIteratorSource >::imageDiagonalSize, mimas::find_line< ImageIteratorSource >::nbOrientationDiv, mimas::find_line< ImageIteratorSource >::parameterSpace, mimas::find_line< ImageIteratorSource >::ul, and mimas::find_line< ImageIteratorSource >::w.
Referenced by mimas::find_line< ImageIteratorSource >::exec(), and mimas::find_line< ImageIteratorSource >::getLines().
void mimas::find_line< ImageIteratorSource >::findMax | ( | void | ) | [inline, protected] |
Definition at line 111 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::maxVal, and mimas::find_line< ImageIteratorSource >::parameterSpace.
Referenced by mimas::find_line< ImageIteratorSource >::exec(), and mimas::find_line< ImageIteratorSource >::getLines().
void mimas::find_line< ImageIteratorSource >::findLine | ( | void | ) | [inline, protected] |
Definition at line 119 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::imageDiagonalSize, mimas::find_line< ImageIteratorSource >::lines, mimas::find_line< ImageIteratorSource >::maxVal, mimas::find_line< ImageIteratorSource >::nbOrientationDiv, mimas::find_line< ImageIteratorSource >::parameterSpace, mimas::find_line< ImageIteratorSource >::polar_to_castesian(), and mimas::find_line< ImageIteratorSource >::thresh.
Referenced by mimas::find_line< ImageIteratorSource >::exec(), and mimas::find_line< ImageIteratorSource >::getLines().
Here is the call graph for this function:
image<unsigned char> mimas::find_line< ImageIteratorSource >::displayLine | ( | void | ) | [inline, protected] |
Definition at line 128 of file hough_transform2.h.
References mimas::drawLine(), mimas::find_line< ImageIteratorSource >::h, mimas::image< T >::init(), mimas::find_line< ImageIteratorSource >::lines, and mimas::find_line< ImageIteratorSource >::w.
Referenced by mimas::find_line< ImageIteratorSource >::exec().
Here is the call graph for this function:
segment< point > mimas::find_line< ImageIteratorSource >::polar_to_castesian | ( | double | theta, | |
double | r | |||
) | [inline] |
Definition at line 143 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::center_x, mimas::find_line< ImageIteratorSource >::center_y, and mimas::find_line< ImageIteratorSource >::nbOrientationDiv.
Referenced by mimas::find_line< ImageIteratorSource >::findLine().
image< unsigned char > mimas::find_line< ImageIteratorSource >::exec | ( | void | ) | [inline] |
Definition at line 183 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::displayLine(), mimas::find_line< ImageIteratorSource >::findLine(), mimas::find_line< ImageIteratorSource >::findMax(), and mimas::find_line< ImageIteratorSource >::hough().
Here is the call graph for this function:
std::vector< segment< point > > mimas::find_line< ImageIteratorSource >::getLines | ( | void | ) | [inline] |
Definition at line 190 of file hough_transform2.h.
References mimas::find_line< ImageIteratorSource >::findLine(), mimas::find_line< ImageIteratorSource >::findMax(), mimas::find_line< ImageIteratorSource >::hough(), and mimas::find_line< ImageIteratorSource >::lines.
Here is the call graph for this function:
int mimas::find_line< ImageIteratorSource >::nbOrientationDiv [protected] |
Definition at line 70 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::findLine(), mimas::find_line< ImageIteratorSource >::hough(), and mimas::find_line< ImageIteratorSource >::polar_to_castesian().
double mimas::find_line< ImageIteratorSource >::thresh [protected] |
Definition at line 71 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::find_line(), and mimas::find_line< ImageIteratorSource >::findLine().
double mimas::find_line< ImageIteratorSource >::maxVal [protected] |
Definition at line 73 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::findLine(), and mimas::find_line< ImageIteratorSource >::findMax().
ImageIteratorSource mimas::find_line< ImageIteratorSource >::ul [protected] |
Definition at line 75 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::hough().
ImageIteratorSource mimas::find_line< ImageIteratorSource >::lr [protected] |
Definition at line 76 of file hough_transform2.h.
int mimas::find_line< ImageIteratorSource >::w [protected] |
Definition at line 78 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::displayLine(), mimas::find_line< ImageIteratorSource >::find_line(), and mimas::find_line< ImageIteratorSource >::hough().
int mimas::find_line< ImageIteratorSource >::h [protected] |
Definition at line 78 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::displayLine(), mimas::find_line< ImageIteratorSource >::find_line(), and mimas::find_line< ImageIteratorSource >::hough().
int mimas::find_line< ImageIteratorSource >::imageDiagonalSize [protected] |
Definition at line 79 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::findLine(), and mimas::find_line< ImageIteratorSource >::hough().
int mimas::find_line< ImageIteratorSource >::center_x [protected] |
Definition at line 80 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::find_line(), mimas::find_line< ImageIteratorSource >::hough(), and mimas::find_line< ImageIteratorSource >::polar_to_castesian().
int mimas::find_line< ImageIteratorSource >::center_y [protected] |
Definition at line 80 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::find_line(), mimas::find_line< ImageIteratorSource >::hough(), and mimas::find_line< ImageIteratorSource >::polar_to_castesian().
Array2D mimas::find_line< ImageIteratorSource >::parameterSpace [protected] |
Definition at line 82 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::findLine(), mimas::find_line< ImageIteratorSource >::findMax(), and mimas::find_line< ImageIteratorSource >::hough().
std::vector< segment< point > > mimas::find_line< ImageIteratorSource >::lines |
Definition at line 139 of file hough_transform2.h.
Referenced by mimas::find_line< ImageIteratorSource >::displayLine(), mimas::find_line< ImageIteratorSource >::findLine(), and mimas::find_line< ImageIteratorSource >::getLines().