Main class of Tracker, defining API. More...
#include <Tracker.h>
Classes | |
struct | Parameter |
Public Member Functions | |
int | addModel (TomGine::tgModel &m, TomGine::tgPose &pose, std::string label, bool bfc=true) |
Adds a geometrical model to the tracker. | |
int | addModelFromFile (const char *filename, TomGine::tgPose &pose, std::string label, bool bfc=true) |
Adds a geometrical model from file (ply-fileformat) to the tracker. | |
void | drawCalibrationPattern (float point_size=1.0f) |
void | drawCoordinates (float linelength=1.0f) |
void | drawCoordinateSystem (float linelength=0.5f, float linewidth=1.0f, TomGine::tgPose pose=TomGine::tgPose()) |
void | drawImage (unsigned char *image) |
void | drawModel (TomGine::tgPose p) |
void | drawModel (const TomGine::tgModel &m, const TomGine::tgPose &p) |
void | drawModelWireframe (const TomGine::tgModel &m, const TomGine::tgPose &p, float linewidth=1.0f) |
void | drawPixel (float u, float v, vec3 color=vec3(1.0, 1.0, 1.0), float size=1.0f) |
void | drawPoint (float x, float y, float z, float size=1.0) |
virtual void | drawResult (float linewidth=1.0f)=0 |
Draw all models. | |
void | drawTest () |
virtual void | drawTrackerModel (int id, const TomGine::tgPose &p, float linewidth=1.0f) |
virtual void | evaluatePDF (int id, float x_min, float y_min, float x_max, float y_max, int res, const char *meshfile, const char *xfile) |
float | getCamZFar () |
float | getCamZNear () |
bool | getDrawParticlesFlag () |
bool | getEdgesImageFlag () |
cv::Mat | getImage () |
Returns the rendered image. | |
bool | getLockFlag () |
void | getModelConfidence (int id, float &c) |
Get mean confidence value of distribution of a model. | |
void | getModelConfidenceColor (int id, float &c) |
Get confidence value of a model at current pose (color based comparison) | |
void | getModelConfidenceEdge (int id, float &c) |
Get confidence value of a model at current pose (edge based comparison) | |
void | getModelConfidenceState (int id, confidence_state &q) |
Get a tracking quality state of a model. | |
void | getModelEdgeMask (int id, Texture &mask) |
Calculates mask produced by the geometry edges of a model. | |
ModelEntry * | getModelEntry (int id) |
Adds a pose hypothesis to model. | |
void | getModelInitialPose (int id, TomGine::tgPose &p) |
Get the initial pose of a model. | |
void | getModelMask (int id, Texture &mask) |
Calculates mask produced by the geometry edges of a model. | |
bool | getModelMaskOwnEdges (int id) |
Gets flag to mask geometry edges of model. | |
int | getModelModeFlag () |
void | getModelMovementState (int id, movement_state &m) |
Get movement state of a model. | |
bool | getModelPoint3D (int id, int x_win, int y_win, double &x3, double &y3, double &z3) |
Get 3D point from 2D window coordinates. | |
void | getModelPose (int id, TomGine::tgPose &p) |
Get current pose of a model. | |
void | getModelPoseCamCoords (int id, TomGine::tgPose &p) |
Get current pose of a model in camera coordinates. | |
void | getModelPoseLPF (int id, TomGine::tgPose &p) |
Get low pass filtered pose of a model. | |
void | getModelQualityState (int id, quality_state &q) |
Get a tracking quality state of a model. | |
void | getModelVelocity (int id, float &translational, float &angular) |
Get current velocity of a model ( in m/s and rad/s ) | |
const Parameter | getParams () |
virtual std::vector< float > | getPDFxy (Particle pose, float x_min, float y_min, float x_max, float y_max, int res, const char *filename=NULL, const char *filename2=NULL) |
unsigned int | getSpreadLvl () |
virtual void | image_processing (unsigned char *image, GLenum format=GL_BGR)=0 |
Perform image processing with edge detection. | |
virtual void | image_processing (unsigned char *image, const TomGine::tgModel &model, const TomGine::tgPose &pose, GLenum format=GL_BGR)=0 |
Perform image processing with edge detection, painting a virtual object into the image. | |
virtual void | image_processing (unsigned char *image, int model_id, const TomGine::tgPose &pose, GLenum format=GL_BGR)=0 |
Perform image processing with edge detection, painting the model with id as virtual object into image. | |
bool | init (const char *trackINIFile, const char *camCalFile, const char *poseCalFile) |
Initialize tracker with an INI file and image/window width and height in pixel. | |
bool | init (const Parameter &trackParam) |
void | loadCalibrationPattern (const char *mdl_file) |
void | loadImage (unsigned char *image, GLenum format=GL_BGR) |
Perform image processing with edge detection. | |
void | printStatistics () |
void | removeModel (int id) |
Remove model from tracker by id. | |
void | reset () |
Resets the pose of all models to the initial pose. | |
void | reset (int id) |
Resets the pose of a model to the initial pose. | |
void | resetUnlockLock () |
Uses the reset function but also locks, calls track() and unlocks the tracker so every confidence will get updated. | |
void | saveModel (int id, const char *pathname) |
Save model to file. | |
void | saveModels (const char *pathname) |
Save all models to file. | |
virtual void | savePDF (std::vector< float > vPDFMap, float x_min, float y_min, float x_max, float y_max, int res, const char *meshfile, const char *xfile) |
void | saveScreenshot (const char *filename) |
Takes screenshot and saves it to file. | |
bool | setCameraParameters (TomGine::tgCamera::Parameter cam_par) |
virtual void | setColorShader () |
void | setDrawParticlesFlag (bool val) |
virtual void | setEdgeShader () |
void | setEdgesImageFlag (bool val) |
void | setFrameTime (double dTime) |
virtual void | setKernelSize (int val) |
void | setLockFlag (bool val) |
void | setModelInitialPose (int id, TomGine::tgPose &p) |
Set the initial pose of a model. | |
void | setModelLock (int id, bool lock) |
Locks the model with id. | |
void | setModelMask (int id, Texture *mask=0) |
Sets mask for a model to define edges which are not considered for the model. | |
void | setModelMaskOwnEdges (int id, bool masked) |
Sets flag to mask geometry edges of model. | |
void | setModelModeFlag (int val) |
void | setModelPredictor (int id, Predictor *predictor) |
Set a model predictor. | |
void | setModelPredictorNoConvergence (int id, float no_conv) |
Set the number of particles (in percent) which are voting for no convergence (for capturing fast movement) | |
void | setModelRecursionsParticle (int id, int num_recursions, int num_particles) |
Sets the number of recursions and particles used for tracking. | |
void | setSpreadLvl (unsigned int val) |
virtual void | textureFromImage (bool force=false) |
Captures image and attaches it to model as texture. | |
virtual void | textureFromImage (int id, const TomGine::tgPose &pose, bool use_num_pixels=true) |
virtual bool | track ()=0 |
Tracks all models by matching their edges against edges of images. | |
virtual bool | track (int id)=0 |
Tracks model by id by matching their edges against edges of images. | |
Tracker () | |
virtual void | untextureModels () |
Remove textures from model. | |
~Tracker () | |
Protected Member Functions | |
void | computeModelEdgeMask (ModelEntry *modelEntry, Texture &mask) |
void | getGlError () |
bool | init () |
bool | initGL () |
virtual bool | initInternal ()=0 |
bool | loadCamParsFromINI (const char *camCalFile, const char *poseCalFile) |
bool | loadTrackParsFromINI (const char *inifile) |
Load parameter of tracker with an INI file. | |
Protected Attributes | |
std::vector< vec3 > | m_calib_points |
TomGine::tgCamera | m_cam_default |
TomGine::tgCamera | m_cam_perspective |
bool | m_draw_edges |
bool | m_drawimage |
float | m_ftime |
ModelEntryList | m_hypotheses |
ImageProcessor * | m_ip |
TomGine::tgLighting | m_lighting |
bool | m_lock |
ModelEntryList | m_modellist |
int | m_showmodel |
bool | m_showparticles |
Texture * | m_tex_frame |
std::vector< Texture * > | m_tex_frame_ip |
Timer | m_timer |
bool | m_tracker_initialized |
Parameter | params |
int Tracking::Tracker::addModel | ( | TomGine::tgModel & | m, |
TomGine::tgPose & | pose, | ||
std::string | label, | ||
bool | bfc = true |
||
) |
Adds a geometrical model to the tracker.
int Tracking::Tracker::addModelFromFile | ( | const char * | filename, |
TomGine::tgPose & | pose, | ||
std::string | label, | ||
bool | bfc = true |
||
) |
Adds a geometrical model from file (ply-fileformat) to the tracker.
filename | absolute filename of the model (or relative to the execution path) |
pose | place where the model is initially put to |
label | label of the model |
bfc | enable/disable backfaceculling (look up OpenGL Backface Culling) |
void Tracking::Tracker::computeModelEdgeMask | ( | ModelEntry * | modelEntry, |
Texture & | mask | ||
) | [protected] |
void Tracking::Tracker::drawCalibrationPattern | ( | float | point_size = 1.0f | ) |
void Tracking::Tracker::drawCoordinates | ( | float | linelength = 1.0f | ) |
void Tracking::Tracker::drawCoordinateSystem | ( | float | linelength = 0.5f , |
float | linewidth = 1.0f , |
||
TomGine::tgPose | pose = TomGine::tgPose() |
||
) |
void Tracking::Tracker::drawImage | ( | unsigned char * | image | ) |
void Tracking::Tracker::drawModel | ( | TomGine::tgPose | p | ) |
void Tracking::Tracker::drawModel | ( | const TomGine::tgModel & | m, |
const TomGine::tgPose & | p | ||
) |
void Tracking::Tracker::drawModelWireframe | ( | const TomGine::tgModel & | m, |
const TomGine::tgPose & | p, | ||
float | linewidth = 1.0f |
||
) |
void Tracking::Tracker::drawPixel | ( | float | u, |
float | v, | ||
vec3 | color = vec3(1.0, 1.0, 1.0) , |
||
float | size = 1.0f |
||
) |
void Tracking::Tracker::drawPoint | ( | float | x, |
float | y, | ||
float | z, | ||
float | size = 1.0 |
||
) |
virtual void Tracking::Tracker::drawResult | ( | float | linewidth = 1.0f | ) | [pure virtual] |
Draw all models.
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
void Tracking::Tracker::drawTest | ( | ) |
virtual void Tracking::Tracker::drawTrackerModel | ( | int | id, |
const TomGine::tgPose & | p, | ||
float | linewidth = 1.0f |
||
) | [inline, virtual] |
Reimplemented in Tracking::TextureTracker.
virtual void Tracking::Tracker::evaluatePDF | ( | int | id, |
float | x_min, | ||
float | y_min, | ||
float | x_max, | ||
float | y_max, | ||
int | res, | ||
const char * | meshfile, | ||
const char * | xfile | ||
) | [inline, virtual] |
Reimplemented in Tracking::TextureTracker.
float Tracking::Tracker::getCamZFar | ( | ) | [inline] |
float Tracking::Tracker::getCamZNear | ( | ) | [inline] |
bool Tracking::Tracker::getDrawParticlesFlag | ( | ) | [inline] |
bool Tracking::Tracker::getEdgesImageFlag | ( | ) | [inline] |
void Tracking::Tracker::getGlError | ( | ) | [protected] |
cv::Mat Tracking::Tracker::getImage | ( | ) |
Returns the rendered image.
bool Tracking::Tracker::getLockFlag | ( | ) | [inline] |
void Tracking::Tracker::getModelConfidence | ( | int | id, |
float & | c | ||
) |
Get mean confidence value of distribution of a model.
void Tracking::Tracker::getModelConfidenceColor | ( | int | id, |
float & | c | ||
) |
Get confidence value of a model at current pose (color based comparison)
void Tracking::Tracker::getModelConfidenceEdge | ( | int | id, |
float & | c | ||
) |
Get confidence value of a model at current pose (edge based comparison)
void Tracking::Tracker::getModelConfidenceState | ( | int | id, |
confidence_state & | q | ||
) |
Get a tracking quality state of a model.
void Tracking::Tracker::getModelEdgeMask | ( | int | id, |
Texture & | mask | ||
) |
Calculates mask produced by the geometry edges of a model.
ModelEntry* Tracking::Tracker::getModelEntry | ( | int | id | ) |
Adds a pose hypothesis to model.
DO NOT USE THIS FUNCTION!
void Tracking::Tracker::getModelInitialPose | ( | int | id, |
TomGine::tgPose & | p | ||
) |
Get the initial pose of a model.
void Tracking::Tracker::getModelMask | ( | int | id, |
Texture & | mask | ||
) |
Calculates mask produced by the geometry edges of a model.
bool Tracking::Tracker::getModelMaskOwnEdges | ( | int | id | ) |
Gets flag to mask geometry edges of model.
int Tracking::Tracker::getModelModeFlag | ( | ) | [inline] |
void Tracking::Tracker::getModelMovementState | ( | int | id, |
movement_state & | m | ||
) |
Get movement state of a model.
bool Tracking::Tracker::getModelPoint3D | ( | int | id, |
int | x_win, | ||
int | y_win, | ||
double & | x3, | ||
double & | y3, | ||
double & | z3 | ||
) |
Get 3D point from 2D window coordinates.
void Tracking::Tracker::getModelPose | ( | int | id, |
TomGine::tgPose & | p | ||
) |
Get current pose of a model.
void Tracking::Tracker::getModelPoseCamCoords | ( | int | id, |
TomGine::tgPose & | p | ||
) |
Get current pose of a model in camera coordinates.
void Tracking::Tracker::getModelPoseLPF | ( | int | id, |
TomGine::tgPose & | p | ||
) |
Get low pass filtered pose of a model.
void Tracking::Tracker::getModelQualityState | ( | int | id, |
quality_state & | q | ||
) |
Get a tracking quality state of a model.
void Tracking::Tracker::getModelVelocity | ( | int | id, |
float & | translational, | ||
float & | angular | ||
) |
Get current velocity of a model ( in m/s and rad/s )
const Parameter Tracking::Tracker::getParams | ( | ) | [inline] |
virtual std::vector<float> Tracking::Tracker::getPDFxy | ( | Particle | pose, |
float | x_min, | ||
float | y_min, | ||
float | x_max, | ||
float | y_max, | ||
int | res, | ||
const char * | filename = NULL , |
||
const char * | filename2 = NULL |
||
) | [inline, virtual] |
unsigned int Tracking::Tracker::getSpreadLvl | ( | ) | [inline] |
virtual void Tracking::Tracker::image_processing | ( | unsigned char * | image, |
GLenum | format = GL_BGR |
||
) | [pure virtual] |
Perform image processing with edge detection.
image | image data |
format | data format |
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
virtual void Tracking::Tracker::image_processing | ( | unsigned char * | image, |
const TomGine::tgModel & | model, | ||
const TomGine::tgPose & | pose, | ||
GLenum | format = GL_BGR |
||
) | [pure virtual] |
Perform image processing with edge detection, painting a virtual object into the image.
image | image data |
model | geometry of virtual object |
pose | position and orientation of the virtual object in world space |
format | data format |
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
virtual void Tracking::Tracker::image_processing | ( | unsigned char * | image, |
int | model_id, | ||
const TomGine::tgPose & | pose, | ||
GLenum | format = GL_BGR |
||
) | [pure virtual] |
Perform image processing with edge detection, painting the model with id as virtual object into image.
image | image data |
model_id | id of the model |
pose | position and orientation of the virtual object in world space |
format | data format |
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
bool Tracking::Tracker::init | ( | const char * | trackINIFile, |
const char * | camCalFile, | ||
const char * | poseCalFile | ||
) |
Initialize tracker with an INI file and image/window width and height in pixel.
bool Tracking::Tracker::init | ( | const Parameter & | trackParam | ) |
bool Tracking::Tracker::init | ( | ) | [protected] |
bool Tracking::Tracker::initGL | ( | ) | [protected] |
virtual bool Tracking::Tracker::initInternal | ( | ) | [protected, pure virtual] |
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
void Tracking::Tracker::loadCalibrationPattern | ( | const char * | mdl_file | ) |
bool Tracking::Tracker::loadCamParsFromINI | ( | const char * | camCalFile, |
const char * | poseCalFile | ||
) | [protected] |
void Tracking::Tracker::loadImage | ( | unsigned char * | image, |
GLenum | format = GL_BGR |
||
) |
Perform image processing with edge detection.
bool Tracking::Tracker::loadTrackParsFromINI | ( | const char * | inifile | ) | [protected] |
Load parameter of tracker with an INI file.
void Tracking::Tracker::printStatistics | ( | ) |
void Tracking::Tracker::removeModel | ( | int | id | ) |
Remove model from tracker by id.
void Tracking::Tracker::reset | ( | ) |
Resets the pose of all models to the initial pose.
void Tracking::Tracker::reset | ( | int | id | ) |
Resets the pose of a model to the initial pose.
id | the id of the model given by addModel() or addModelFromFile() |
void Tracking::Tracker::resetUnlockLock | ( | ) |
Uses the reset function but also locks, calls track() and unlocks the tracker so every confidence will get updated.
void Tracking::Tracker::saveModel | ( | int | id, |
const char * | pathname | ||
) |
Save model to file.
void Tracking::Tracker::saveModels | ( | const char * | pathname | ) |
Save all models to file.
virtual void Tracking::Tracker::savePDF | ( | std::vector< float > | vPDFMap, |
float | x_min, | ||
float | y_min, | ||
float | x_max, | ||
float | y_max, | ||
int | res, | ||
const char * | meshfile, | ||
const char * | xfile | ||
) | [inline, virtual] |
void Tracking::Tracker::saveScreenshot | ( | const char * | filename | ) |
Takes screenshot and saves it to file.
bool Tracking::Tracker::setCameraParameters | ( | TomGine::tgCamera::Parameter | cam_par | ) |
virtual void Tracking::Tracker::setColorShader | ( | ) | [inline, virtual] |
Reimplemented in Tracking::TextureTracker.
void Tracking::Tracker::setDrawParticlesFlag | ( | bool | val | ) | [inline] |
virtual void Tracking::Tracker::setEdgeShader | ( | ) | [inline, virtual] |
Reimplemented in Tracking::TextureTracker.
void Tracking::Tracker::setEdgesImageFlag | ( | bool | val | ) | [inline] |
void Tracking::Tracker::setFrameTime | ( | double | dTime | ) |
virtual void Tracking::Tracker::setKernelSize | ( | int | val | ) | [inline, virtual] |
Reimplemented in Tracking::TextureTracker.
void Tracking::Tracker::setLockFlag | ( | bool | val | ) |
void Tracking::Tracker::setModelInitialPose | ( | int | id, |
TomGine::tgPose & | p | ||
) |
Set the initial pose of a model.
void Tracking::Tracker::setModelLock | ( | int | id, |
bool | lock | ||
) |
Locks the model with id.
void Tracking::Tracker::setModelMask | ( | int | id, |
Texture * | mask = 0 |
||
) |
Sets mask for a model to define edges which are not considered for the model.
void Tracking::Tracker::setModelMaskOwnEdges | ( | int | id, |
bool | masked | ||
) |
Sets flag to mask geometry edges of model.
void Tracking::Tracker::setModelModeFlag | ( | int | val | ) | [inline] |
void Tracking::Tracker::setModelPredictor | ( | int | id, |
Predictor * | predictor | ||
) |
Set a model predictor.
void Tracking::Tracker::setModelPredictorNoConvergence | ( | int | id, |
float | no_conv | ||
) |
Set the number of particles (in percent) which are voting for no convergence (for capturing fast movement)
void Tracking::Tracker::setModelRecursionsParticle | ( | int | id, |
int | num_recursions, | ||
int | num_particles | ||
) |
Sets the number of recursions and particles used for tracking.
void Tracking::Tracker::setSpreadLvl | ( | unsigned int | val | ) | [inline] |
virtual void Tracking::Tracker::textureFromImage | ( | bool | force = false | ) | [inline, virtual] |
Captures image and attaches it to model as texture.
Reimplemented in Tracking::TextureTracker.
virtual void Tracking::Tracker::textureFromImage | ( | int | id, |
const TomGine::tgPose & | pose, | ||
bool | use_num_pixels = true |
||
) | [inline, virtual] |
Reimplemented in Tracking::TextureTracker.
virtual bool Tracking::Tracker::track | ( | ) | [pure virtual] |
Tracks all models by matching their edges against edges of images.
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
virtual bool Tracking::Tracker::track | ( | int | id | ) | [pure virtual] |
Tracks model by id by matching their edges against edges of images.
id | the id of the model given by addModel() or addModelFromFile() |
Implemented in Tracking::TextureTracker, and Tracking::EdgeTracker.
virtual void Tracking::Tracker::untextureModels | ( | ) | [inline, virtual] |
Remove textures from model.
Reimplemented in Tracking::TextureTracker.
std::vector<vec3> Tracking::Tracker::m_calib_points [protected] |
TomGine::tgCamera Tracking::Tracker::m_cam_default [protected] |
bool Tracking::Tracker::m_draw_edges [protected] |
bool Tracking::Tracker::m_drawimage [protected] |
float Tracking::Tracker::m_ftime [protected] |
ModelEntryList Tracking::Tracker::m_hypotheses [protected] |
ImageProcessor* Tracking::Tracker::m_ip [protected] |
TomGine::tgLighting Tracking::Tracker::m_lighting [protected] |
bool Tracking::Tracker::m_lock [protected] |
ModelEntryList Tracking::Tracker::m_modellist [protected] |
int Tracking::Tracker::m_showmodel [protected] |
bool Tracking::Tracker::m_showparticles [protected] |
Texture* Tracking::Tracker::m_tex_frame [protected] |
std::vector<Texture*> Tracking::Tracker::m_tex_frame_ip [protected] |
Timer Tracking::Tracker::m_timer [protected] |
bool Tracking::Tracker::m_tracker_initialized [protected] |
Parameter Tracking::Tracker::params [protected] |