Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends
jafar::rtslam::ActiveSearchGrid Class Reference

Active search tesselation grid. More...


Detailed Description

Active search tesselation grid.

Author:
jsola

This class implements a tesselation grid for achieving active search behavior in landmark initialization.

The grid defines a set of cells in the image. The idea is to count the number of projected landmarks per grid cell, and use one randomly chosen cell that is empty for feature detection and landmark initialization. This guarantees that the system will automatically populate all the regions of the image.

The feature density can be controlled by adjusting the grid's number of cells. Typically, use grids of 5x5 to 9x9 cells.

This class implements a few interesting features:

The blue and green grids in the figure below represent the grid at two different offsets, corresponding to two different frames.

tesselationGrid.png
The tesselation grid used for active feature detection and initialization

This second figure shows a typical situation that we use to explain the basic mechanism.

tesselationExample.png
A typical configuration of the tesselation grid

Observe the figure and use the following facts as an operation guide:

We include here a schematic active-search pseudo-code algorithm to illustrate its operation:

 // Init necessary objects
 ActiveSearch activeSearch;
 ActiveSearchGrid grid(640, 480, 4, 4, 10); // Construction with 10 pixels separation.

 // We start projecting everybody
 for (obs = begin(); obs != end(); obs++)   // loop observations
 {
   obs->project();
   if (obs->isVisible())
     grid.addObs(obs->expectation.x());   // add only visible landmarks
 }

 // Then we process the selected observations
 activeSearch.selectObs();                  // select interesting features
 for (activeSearch.selectedObs);            // loop selected obs
   obs.process();                           // process observation

 // Now we go to initialization
 grid.getRoi(roi);                          // roi is now region of interest
 if (detectFeature(roi))                    // detect inside ROI
   initLandmark();                          // initialize only if successful detection

Definition at line 109 of file activeSearch.hpp.

#include <activeSearch.hpp>

List of all members.

Public Types

typedef std::vector
< std::vector
< observation_ptr_t > > 
Grid

Public Member Functions

 ActiveSearchGrid (const int &imgSize_h, const int &imgSize_v, const int &nCells_h, const int &nCells_v, const int &margin=0, const int &separation=0)
 Constructor.
void clear ()
 Clear grid.
void renew ()
 Clear grid and position it at a new random location.
void addObs (const vec2 &pix, observation_ptr_t obsPtr)
 Add a projected pixel to the grid.
bool getRoi (image::ConvexRoi &roi)
 Get ROI of a random empty cell.
void setFailed (const image::ConvexRoi &roi)
 Call this after getRoi if no point was found in the roi in order to avoid searching again in it.

Public Attributes

Grid projections

Private Member Functions

template<class Vec2 >
veci2 pix2cell (const Vec2 &pix)
 Get cell corresponding to pixel.
veci2 cellOrigin (const veci2 &cell)
 Get cell origin (exact pixel)
vec2 cellCenter (const veci2 &cell)
 Get cell center (can be decimal if size of cell is an odd number of pixels)
bool pickEmptyCell (veci2 &cell)
 Get one random empty cell.
void cell2roi (const veci2 &cell, image::ConvexRoi &roi)
 Get the region of interest, reduced by a margin.

Private Attributes

veci2 imgSize
veci2 gridSize
veci2 cellSize
veci2 offset
mati projectionsCount
mati emptyCellsTile_tmp
int separation
int margin
int cells_h

Friends

std::ostream & operator<< (std::ostream &s, ActiveSearchGrid const &grid)

Constructor & Destructor Documentation

jafar::rtslam::ActiveSearchGrid::ActiveSearchGrid ( const int &  imgSize_h,
const int &  imgSize_v,
const int &  nCells_h,
const int &  nCells_v,
const int &  margin = 0,
const int &  separation = 0 
)

Constructor.

Parameters:
imgSize_hhorizontal image size, in pixels.
imgSize_vvertical image size.
nCells_hhorizontal number of cells per image width.
nCells_vvertical number of cells per image height.
separationminimum separation between existing and new points.

Member Function Documentation

void jafar::rtslam::ActiveSearchGrid::addObs ( const vec2 pix,
observation_ptr_t  obsPtr 
)

Add a projected pixel to the grid.

Parameters:
pixthe pixel to add.

Clear grid.

Sets all cell counters to zero.

Get ROI of a random empty cell.

Parameters:
roithe resulting ROI
Returns:
true if ROI exists.

Clear grid and position it at a new random location.

Sets all cell counters to zero and sets a new random grid position.

Call this after getRoi if no point was found in the roi in order to avoid searching again in it.

Parameters:
roithe ROI where nothing was found

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:44 for Jafar by doxygen 1.7.6.1
LAAS-CNRS