#include <gocam.hh>
Public Member Functions | |
Analyser () | |
The Default constructor. | |
void | reset (const CImg< float > &img) |
Reset the class for analysing a new image. | |
void | analyse () |
Complete analyse of the image. | |
void | compute_line_images () |
Compute the line image in line_image. | |
void | compute_hough_image () |
Compute the hough image in hough_image. | |
void | compute_initial_grid () |
Compute an initial small grid from the Hough image. | |
void | tune_line (geom::Line &line, geom::Point d1, geom::Point d2) |
Tune a single line to match the line image. | |
void | tune_grid () |
Tune the grid lines to match the line image. | |
void | grow_grid () |
Grow the grid to the full size. | |
void | add_best_line (int series) |
Grow line series by adding a new line to the best direction. | |
Public Attributes | |
Parameters for the analysis | |
int | verbose |
Verbosity level. | |
int | board_size |
The size of the board (default 19). | |
int | line_peak_filter_width |
The width of the peak filter used to compute the line image (default 5). | |
int | hough_peak_filter_width |
The width of the peak filter used to enhance the Hough image (default 5). | |
float | line_image_sigma |
The standard deviation of the centered Gaussian to get the weighted line image. | |
int | approx_series_width |
The approximate maximum width of the series used for the initial grid (default 10). | |
int | approx_theta_remove_range |
The range to remove around the first approximate theta (default 25). | |
int | median_peak_remove_width |
The width of the median peak remover used for the initial grid (default 10). | |
int | num_initial_lines |
The number of lines for the initial grid (default 5). | |
int | max_initial_lines |
The maximum number of lines for the initial grid before taking the middlemost lines (default 10). | |
Intermediate results of the analysis | |
CImg< float > | image |
The original image. | |
CImg< float > | line_image |
The line image. | |
CImg< float > | weighted_line_image |
The line image weighted with a centered Gaussian. | |
CImg< float > | hough_image |
Hough transform of the weighted line image. | |
CImg< float > | blurred_hough_image |
Horizontally blurred version of the Hough transform. | |
CImg< float > | blurred_column_sum |
The sum of columns of blurred_hough_image . | |
int | approx_theta [2] |
The approximate positions of the vertical series of maximums. | |
CImg< float > | max_rho [2] |
Vertical maximum cuts of the series. | |
std::vector< geom::LineRT > | initial_lines [2] |
The initial grid lines in polar system. | |
std::vector< geom::Line > | lines [2] |
The grid lines in Euclidian space. |
The complete analysis is performed simply by calling the analyse() function after setting the original image with the reset() function. The analysis steps can also be called individually if it is desired to debug the steps or display intermediate results. The steps are
The compute_hough_image() method does nothing, if the x- and y-dimensions of hough_image are already positive. This allows the use of a precomputed hough image when new analysis features are tested in later phases.
|
Grow line series by adding a new line to the best direction.
|
|
Compute the hough image in hough_image.
If |
|
Compute an initial small grid from the Hough image. Each line in the original image can be seen as a local maximum in the Hough image. Since parallel lines in the original image have almost the same angle, the corresponding peaks form an almost vertical series of maximums in the Hough image. This function finds a set of lines that form a small grid in the Hough image. |
|
Reset the class for analysing a new image.
|
|
Tune the grid lines to match the line image.
|
|
Tune a single line to match the line image.
|
|
The initial grid lines in polar system. The two vectors contain the horizontal and vertical lines respectively. |
|
The standard deviation of the centered Gaussian to get the weighted line image. The value is used for both x and y-dimensions, and is relative to the size of the image. Value 1.0 means a standard deviation of half of the image. The default is 0.2. |
|
The grid lines in Euclidian space. The two vectors contain the horizontal and vertical lines respectively. |