Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | Related Pages

gocam.hh

00001 /* 
00002 
00003 GoCam - A computer vision tool for extracting moves from go videos
00004 Copyright (C) 2005 Teemu Hirsimäki 
00005 Email: teemu.hirsimaki [at domain] iki.fi
00006 
00007 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or (at
00010 your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful, but
00013 WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software
00019 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00020 USA.
00021 
00022 */
00023 
00024 #ifndef GOCAM_HH
00025 #define GOCAM_HH
00026 
00027 #include "geom.hh"
00028 #include "CImg.h"
00029 #include <vector>
00030 
00031 using namespace cimg_library;
00032 
00040 namespace gocam {
00041 
00060   struct Analyser {
00062     Analyser();
00063 
00067     void reset(const CImg<float> &img);
00068 
00070     void analyse();
00071 
00073     void compute_line_images();
00074 
00081     void compute_hough_image();
00082 
00092     void compute_initial_grid();
00093 
00103     void tune_line(geom::Line &line, geom::Point d1, geom::Point d2);
00104 
00109     void tune_grid();
00110 
00112     void grow_grid();
00113 
00118     void add_best_line(int series);
00119 
00123   private:
00124 
00132     std::vector<float> rho_differences(const std::vector<geom::LineRT> &vec);
00133 
00141     float score_new_line(const geom::Line &new_line, 
00142                          const geom::Line &next_line,
00143                          const std::vector<geom::Line> &lines);
00144 
00145   public:
00146 
00149 
00151     int verbose;
00152 
00154     int board_size;
00155 
00159     int line_peak_filter_width; 
00160 
00164     int hough_peak_filter_width; 
00165 
00173     float line_image_sigma;
00174 
00177     int approx_series_width;
00178 
00180     int approx_theta_remove_range;
00181         
00185     int median_peak_remove_width;
00186 
00188     int num_initial_lines;
00189 
00193     int max_initial_lines;
00194     
00196 
00197 
00198 
00201 
00202     CImg<float> image; 
00203     CImg<float> line_image; 
00204 
00206     CImg<float> weighted_line_image; 
00207 
00209     CImg<float> hough_image; 
00210 
00212     CImg<float> blurred_hough_image; 
00213 
00215     CImg<float> blurred_column_sum;
00216 
00218     int approx_theta[2];
00219 
00221     CImg<float> max_rho[2];
00222 
00228     std::vector<geom::LineRT> initial_lines[2];
00229     
00235     std::vector<geom::Line> lines[2];
00236 
00238 
00239   };
00240 
00241 };
00242 
00243 #endif /* GOCAM_HH */

Generated on Sat Feb 26 22:54:39 2005 for GoCam by doxygen 1.3.4