gocam::Analyser Struct Reference

A class for analysing images of go boards and storing various information about the analysis. More...

#include <gocam.hh>

List of all members.

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 fix_end_points ()
 Fix end points of the lines to match the perpendicular lines.
void tune_line (geom::Line &line, geom::Line d1, geom::Line 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 (bool only_once=false)
 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::LineRTinitial_lines [2]
 The initial grid lines in polar system.
std::vector< geom::Linelines [2]
 The grid lines in Euclidian space.


Detailed Description

A class for analysing images of go boards and storing various information about the analysis.

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.


Member Function Documentation

void gocam::Analyser::add_best_line int  series  ) 
 

Grow line series by adding a new line to the best direction.

Parameters:
series = the line series to process (0 = horizontal, 1 = vertical)

void gocam::Analyser::compute_hough_image  ) 
 

Compute the hough image in hough_image.

If hough_image has height and width already, the computation is skipped. This allows to load a precomputed hough image to save time in debugging later parts of the analysis.

void gocam::Analyser::compute_initial_grid  ) 
 

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.

void gocam::Analyser::grow_grid bool  only_once = false  ) 
 

Grow the grid to the full size.

Parameters:
only_once = if true, only one step of growing is performed

void gocam::Analyser::reset const CImg< float > &  img  ) 
 

Reset the class for analysing a new image.

Parameters:
img = the image to analyse

void gocam::Analyser::tune_grid  ) 
 

Tune the grid lines to match the line image.

Note:
Assumes that the grid lines are sorted correctly.

void gocam::Analyser::tune_line geom::Line line,
geom::Line  d1,
geom::Line  d2
 

Tune a single line to match the line image.

Warning:
Does not check that the line stays inside the image boundaries.
Parameters:
line = the line to be tuned
d1 = the testing segment for the first end point
d2 = the testing segment for the second end point


Member Data Documentation

std::vector<geom::LineRT> gocam::Analyser::initial_lines[2]
 

The initial grid lines in polar system.

The two vectors contain the horizontal and vertical lines respectively.

float gocam::Analyser::line_image_sigma
 

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.

std::vector<geom::Line> gocam::Analyser::lines[2]
 

The grid lines in Euclidian space.

The two vectors contain the horizontal and vertical lines respectively.


The documentation for this struct was generated from the following files:
Generated on Tue Apr 8 09:58:19 2008 for GoCam by  doxygen 1.4.6