labyrinth.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_LABYRINTH_H_INCLUDED
21 #define HEADER_LABYRINTH_H_INCLUDED
22 
28 #include <opencv2/core/core.hpp>
29 #include <opencv2/imgproc/imgproc.hpp>
30 #include <opencv2/highgui/highgui.hpp>
31 #include <iostream>
32 #include <laustracker/conf.h>
33 #include <laustracker/map.h>
34 
35 using namespace std;
36 using namespace cv;
37 
39 typedef struct wall_t
40 {
42  Rect roi;
44  int x, y;
48  bool exists;
49 
50 } wall_t;
51 
60 void findLabyrinth(const Mat& image, int hough_threshold,
61  vector< Point >& labyrinth_rect, int debuglevel = 0);
62 
72 void findLabyrinth(const Mat& image, vector <Point>& labyrinth_rect,
73  String labyrinth_conf_filename, int debuglevel = 0);
74 
83 void findSquares(const Mat& image, vector<vector<Point> >& squares,
84  Mat& contours_img, int debuglevel = 0);
85 
92 void drawSquares(Mat& image, const vector<vector<Point> >& squares);
93 
98 void getContours(Mat& image);
99 
107 void getGrid(const Mat& image, const std::vector< Point >& labyrinth,
108  vector< wall_t >& walls, int debuglevel = 0);
109 
119 void getGrid2(const Mat& color_image, const Mat& white_image,
120  const String mask_filename, const vector<Point> & labyrinth,
121  vector <wall_t>& walls, int debuglevel);
122 
130 void check_for_wall(vector< wall_t >& walls, const Mat& white_img,
131  Mat& color_img, int debuglevel = 0);
132 
140 void check_for_black_line(vector< wall_t >& walls, const Mat& white_img,
141  Mat& color_img, int debuglevel = 0);
142 
149 void drawLabyrinthRect(const Mat& image, Mat& img,
150  const vector<Point> & labyrinth);
151 
152 #endif
void getGrid(const Mat &image, const std::vector< Point > &labyrinth, vector< wall_t > &walls, int debuglevel=0)
Overlay the labyrinth with a grid for wall positions.
PosType pos
Position within the field.
Definition: labyrinth.h:46
enum PosEnum PosType
Possible positions within a field.
int x
Field index.
Definition: labyrinth.h:44
void check_for_black_line(vector< wall_t > &walls, const Mat &white_img, Mat &color_img, int debuglevel=0)
Check a ROI (region of interest) whether there is a black line.
Rect roi
Region of Interest.
Definition: labyrinth.h:42
void check_for_wall(vector< wall_t > &walls, const Mat &white_img, Mat &color_img, int debuglevel=0)
Check a ROI (region of interest) whether there is a wall.
void getGrid2(const Mat &color_image, const Mat &white_image, const String mask_filename, const vector< Point > &labyrinth, vector< wall_t > &walls, int debuglevel)
Overlay the labyrinth with a grid for wall positions from a mask image.
void findSquares(const Mat &image, vector< vector< Point > > &squares, Mat &contours_img, int debuglevel=0)
Search for quads within a image.
void getContours(Mat &image)
Locate bounded contours.
void drawLabyrinthRect(const Mat &image, Mat &img, const vector< Point > &labyrinth)
Draw the labyrinth rectangle into a image.
bool exists
Is there a wall.
Definition: labyrinth.h:48
The class LabyrinthMap contains complete information about the labyrinth structure.
void findLabyrinth(const Mat &image, int hough_threshold, vector< Point > &labyrinth_rect, int debuglevel=0)
Locate the labyrinth autonomously.
void drawSquares(Mat &image, const vector< vector< Point > > &squares)
Draw rectangles into a image.
Contains information for a wall element.
Definition: labyrinth.h:39
struct wall_t wall_t
Contains information for a wall element.
Global definitions.