The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
Public Member Functions | List of all members
dune::tracker Class Reference

A simple pattern tracker written with OpenCV. More...

#include <tracker.h>

Public Member Functions

void track_frame (render_target &frame)
 Track loaded patterns in a render_target frame. More...
 
size_t load_pattern (const tstring &filename)
 Load a pattern filename from disk. Returns an ID for the pattern to later identify it.
 
void remove_pattern (size_t id)
 Remove a loaded pattern identified by an ID.
 
DirectX::XMFLOAT4X4 model_view_matrix (FLOAT scale, const DirectX::XMFLOAT3 &translation, const DirectX::XMFLOAT4X4 &rotation, UINT pattern_id=0) const
 Retreive a model-view matrix for a pattern id. More...
 

Detailed Description

A simple pattern tracker written with OpenCV.

This class implements a basic pattern tracker. Patterns are loaded and added to a vector of patterns which are then detected in render_target frames.

Member Function Documentation

DirectX::XMFLOAT4X4 dune::tracker::model_view_matrix ( FLOAT  scale,
const DirectX::XMFLOAT3 &  translation,
const DirectX::XMFLOAT4X4 &  rotation,
UINT  pattern_id = 0 
) const

Retreive a model-view matrix for a pattern id.

This method will construct a model-view matrix necessary to correctly transform 3D geometry according to a tracked pattern. Additionally, rescaling, transformation, and a rotation can be added beforehand. If the pattern wasn't detected in a frame by the method track_frame, then the previously detected matrix will be returned.

Parameters
scaleScales the world before moving it to the pattern.
translationTranslate the world before moving it to the pattern.
rotationRotate the world before moving it to the pattern.
pattern_idThe ID of the pattern, in case more than one is tracked simultanously.
Returns
The model-view matrix to move the world position to the pattern space.
void dune::tracker::track_frame ( render_target frame)

Track loaded patterns in a render_target frame.

This method needs to be called whenever a new render_target is available where tracking should be performed. For each loaded pattern, tracking information will be gathered that can be later accessed with the model_view_matrix() method.

Parameters
frameA render_target frame which has its data cached

The documentation for this class was generated from the following files: