Hi tuskcode,
You are correct that there is limited supporting documentation for the vector tracking functionality in the Camera SDK. We've tried to demonstrate it's functionality with the Vector Tracking sample application but I would be happy to walk you through it here as well as answer questions.
OK, so the vector tracking features in the Camera SDK are split into two modules:
1. cModuleVector. This is the core vector tracking solver. It does not do any post processing on the result. This is just the very core functionality of solving the vector clip without anything else.
2. cModuleVectorProcessing. This is performs all of the post processing on the raw vector results that come out of cModuleVector.
cModuleVector
You need to give this module two things, the settings, and 2D marker data coming from the camera. The output is simply the three 3D marker locations of the vector clip.
The settings are broken down into these three things:
1. Marker Arrangement: Vector Clip, or Track Clip Pro.
2. Distances between clip markers:
Standard Vector Clip:
Distance12 = 116.052;
Distance13 = 116.052;
Distance23 = 69.621;
Track Clip Pro:
Distance12 = 49.961;
Distance13 = 112.014;
Distance23 = 94.539;
3. Camera Intrinsic Parameters:
Slim 3U:
ImagerWidth = 3.84;
ImagerHeight = 2.88;
ImagerFocalLength = 4.44;
PrincipalX = 320;
PrincipalY = 240;
PixelWidth = 640;
PixelHeight = 480;
When you instantiate your cModuleVector, fetch it's settings before populating the settings above so that the rest of the values are meaningful.
The Vector Tracking Sample populates the above as follows:
Code: Select all
cModuleVector *vec = cModuleVector::Create();
Core::DistortionModel lensDistortion;
camera->GetDistortionModel(lensDistortion);
//== Plug distortion into vector module ==--
cVectorSettings vectorSettings;
vectorSettings = *vec->Settings();
vectorSettings.Arrangement = cVectorSettings::VectorClip;
vectorSettings.Enabled = true;
//== Plug in focal length in (mm) by converting it from pixels -> mm
vectorSettings.ImagerFocalLength = (lensDistortion.HorizontalFocalLength/((float)camera->PhysicalPixelWidth()))*camera->ImagerWidth();
vectorSettings.ImagerHeight = camera->ImagerHeight();
vectorSettings.ImagerWidth = camera->ImagerWidth();
vectorSettings.PrincipalX = camera->PhysicalPixelWidth()/2;
vectorSettings.PrincipalY = camera->PhysicalPixelHeight()/2;
vectorSettings.PixelWidth = camera->PhysicalPixelWidth();
vectorSettings.PixelHeight = camera->PhysicalPixelHeight();
vec->SetSettings(vectorSettings);