laustracker.h
Go to the documentation of this file.
1 /*
2  * This file is part of Laustracker.
3  *
4  * Copyright (C) 2013 Christian Jann <christian.jann@ymail.com>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef HEADER_LAUSTRACKER_LAUSTRACKER_H_INCLUDED
21 #define HEADER_LAUSTRACKER_LAUSTRACKER_H_INCLUDED
22 
50 #include <laustracker/version.h>
51 #include <laustracker/map.h>
52 #include <laustracker/util.h>
55 #include <laustracker/labyrinth.h>
56 #include <laustracker/robots.h>
57 
63 {
64 
65 private:
67  vector <Point> labyrinth_pos;
68 
82 
85 
87  bool wrap;
88 
90  bool undistort;
91 
94 
95  bool use_mask;
96  String mask_filename;
97 
100 
101 public:
102 
105 
108 
111 
114 
121  LausTracker();
122 
129  ~LausTracker();
130 
139  bool locate_labyrinth_manually(const Mat& image);
140 
152  bool locate_labyrinth_automatically(const Mat& image, bool reddots = false);
153 
158  vector <Point> get_labyrinth_pos();
159 
166  bool save_labyrinth_pos();
167 
174  bool load_labyrinth_pos();
175 
179  void clear_labyrinth_pos();
180 
185  void locate_walls(Mat& image);
186 
192  void locate_black_lines(Mat& image);
193 
198  void update_robot_positions(Mat image);
199 
204  void setDebug(int level);
205 
206  // bool save_labyrinth_pos();
207  // bool load_labyrinth_pos();
208 
213  bool labyrinthFound();
214 
216  void printMap();
217 
223  Mat improve_image(const Mat& image);
224 
231  void imshow(const string& windoname, const Mat& image);
232 
237  void set_undistort(bool state);
238 
243  void set_wrap(bool state);
244 
249  void use_mask_to_locate_walls(String mask_img_filename);
250 
251 };
252 
253 #endif
A class to do a perspective transformation.
int debuglevel
Definition: laustracker.h:81
void set_wrap(bool state)
The wrap setting, whether a perspective transformation should be done.
bool locate_labyrinth_automatically(const Mat &image, bool reddots=false)
Try to find the labyrinth automatically.
void imshow(const string &windoname, const Mat &image)
Display a image and automatically crop it if the labyrinth position is known-.
~LausTracker()
Deconstructor.
bool save_labyrinth_pos()
Save the labyrinth position to ~/.laustracker/labyrinth_pos.txt.
Contains the class RobotTracker, that can be used to locate robots.
bool wrap
Whether a perspective transformation is needed.
Definition: laustracker.h:87
void printMap()
Print the labyrinth map.
Functions to locate the labyrinth and detect walls.
Contains functions to manipulate images.
LabyrinthMap map
Instance of LabyrinthMap.
Definition: laustracker.h:104
PerspectiveWrapper Wrapper
Instance of PerspectiveWrapper.
Definition: laustracker.h:93
String labyrinth_conf_filename
Path to a labyrinth configuration file.
Definition: laustracker.h:113
Class contains complete information about the labyrinth structure.
Definition: map.h:64
bool labyrinthFound()
Is the labyrinth position already available.
void locate_walls(Mat &image)
Check the existence of walls.
Class to manage all information about the labyrinth position and structure as well as the robot posit...
Definition: laustracker.h:62
RobotTracker robots
Instance of RobotTracker.
Definition: laustracker.h:107
bool labyrinth_found
Was the labyrinth found?
Definition: laustracker.h:84
Class to undistort images.
A class to locate robots.
Definition: robots.h:125
ImageUndistort Undistort
Instance of ImageUndistort.
Definition: laustracker.h:110
Small helper functions.
Mat improve_image(const Mat &image)
Improve camera images (undistort, wrap)
string labyrinth_pos_path
File to save or load the labyrinth position.
Definition: laustracker.h:99
Version information.
bool locate_labyrinth_manually(const Mat &image)
The user should manually click at every labyrinth corner.
void locate_black_lines(Mat &image)
Check the existence of walls by checking the visibility of black lines.
Contains functions to convert colors between different color spaces.
vector< Point > labyrinth_pos
The labyrinth position.
Definition: laustracker.h:67
void update_robot_positions(Mat image)
Update robot positions.
void clear_labyrinth_pos()
Clear the labyrinth position.
The class LabyrinthMap contains complete information about the labyrinth structure.
bool undistort
Undistort the image.
Definition: laustracker.h:90
void use_mask_to_locate_walls(String mask_img_filename)
Set a mask image to locate walls.
bool load_labyrinth_pos()
Load the labyrinth position from ~/.laustracker/labyrinth_pos.txt.
void set_undistort(bool state)
Change the undistort setting.
vector< Point > get_labyrinth_pos()
Returns the labyrinth position.
LausTracker()
Constructor.
void setDebug(int level)
Show debug information.