Classes | Typedefs | Functions
labyrinth.h File Reference

Functions to locate the labyrinth and detect walls. More...

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <laustracker/conf.h>
#include <laustracker/map.h>

Go to the source code of this file.

Classes

struct  wall_t
 Contains information for a wall element. More...
 

Typedefs

typedef struct wall_t wall_t
 Contains information for a wall element. More...
 

Functions

void findLabyrinth (const Mat &image, int hough_threshold, vector< Point > &labyrinth_rect, int debuglevel=0)
 Locate the labyrinth autonomously. More...
 
void findLabyrinth (const Mat &image, vector< Point > &labyrinth_rect, String labyrinth_conf_filename, int debuglevel=0)
 Locate the labyrinth autonomously via red markers at the labyrinth corners. More...
 
void findSquares (const Mat &image, vector< vector< Point > > &squares, Mat &contours_img, int debuglevel=0)
 Search for quads within a image. More...
 
void drawSquares (Mat &image, const vector< vector< Point > > &squares)
 Draw rectangles into a image. More...
 
void getContours (Mat &image)
 Locate bounded contours. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void drawLabyrinthRect (const Mat &image, Mat &img, const vector< Point > &labyrinth)
 Draw the labyrinth rectangle into a image. More...
 

Detailed Description

Functions to locate the labyrinth and detect walls.

Definition in file labyrinth.h.

Typedef Documentation

typedef struct wall_t wall_t

Contains information for a wall element.

Function Documentation

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.

Parameters
wallsReference of a array with walls
white_imgBlack-white image, only walls should be white
color_imgColor image to show the results
debuglevelShow debug information for intermediate steps
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.

Parameters
wallsReference of a array with walls
white_imgBlack-white image, only walls should be white
color_imgColor image to show the results
debuglevelShow debug information for intermediate steps
void drawLabyrinthRect ( const Mat &  image,
Mat &  img,
const vector< Point > &  labyrinth 
)

Draw the labyrinth rectangle into a image.

Parameters
imageThe source image
imgThe destination image
labyrinthPosition of the labyrinth
void drawSquares ( Mat &  image,
const vector< vector< Point > > &  squares 
)

Draw rectangles into a image.

Parameters
imageReference of a image to draw the rectangles.
squaresA vector of vectors with 4 elements each for the corners of the rectangles.
void findLabyrinth ( const Mat &  image,
int  hough_threshold,
vector< Point > &  labyrinth_rect,
int  debuglevel = 0 
)

Locate the labyrinth autonomously.

Parameters
imageImage of the labyrinth
hough_thresholdThreshold for the Hough transformation
labyrinth_rectReference of a std::vector that will contain the labyrinth position.
debuglevelShow debug information for intermediate steps.
void findLabyrinth ( const Mat &  image,
vector< Point > &  labyrinth_rect,
String  labyrinth_conf_filename,
int  debuglevel = 0 
)

Locate the labyrinth autonomously via red markers at the labyrinth corners.

Parameters
imageImage of the labyrinth
labyrinth_rectReference of a std::vector that will contain the labyrinth position.
labyrinth_conf_filenameConfiguration file that contains color values for the labyrinth markers.
debuglevelShow debug information for intermediate steps
void findSquares ( const Mat &  image,
vector< vector< Point > > &  squares,
Mat &  contours_img,
int  debuglevel = 0 
)

Search for quads within a image.

Parameters
imageImage that should be searched
squaresReference of a vector of vectors with 4 elements each for the corners of the quads.
contours_imgBinary image that will contain all quads that were found.
debuglevelShow debug information for intermediate steps
void getContours ( Mat &  image)

Locate bounded contours.

Parameters
imageSource and destination image
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.

Parameters
imageImage of the labyrinth
labyrinthPosition of the labyrinth within the image
wallsReference of a array with walls
debuglevelShow debug information for intermediate steps
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.

Parameters
color_imageColor image of the labyrinth to show debug images.
white_imageBlack-white image of the labyrinth to show debug images.
mask_filenamePath to a mask image, relative to the program executable
labyrinthPosition of the labyrinth within the image
wallsReference of a array with walls
debuglevelShow debug information for intermediate steps