The Dirtchamber
A mixed reality testing environment for real-time global illumination algorithms
|
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... | |
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.
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.
scale | Scales the world before moving it to the pattern. |
translation | Translate the world before moving it to the pattern. |
rotation | Rotate the world before moving it to the pattern. |
pattern_id | The ID of the pattern, in case more than one is tracked simultanously. |
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.
frame | A render_target frame which has its data cached |