private void EstimatePose( )
{
Accord.Point[] projectedPoints = worldRendererControl.ProjectedPoints;
Matrix3x3 rotationMatrix = Matrix3x3.Identity;
Vector3 translationVector = new Vector3( 0 );
if ( objectTypeCombo.SelectedIndex == 0 )
{
posit.EstimatePose( projectedPoints, out rotationMatrix, out translationVector );
}
else
{
coposit.EstimatePose( projectedPoints, out rotationMatrix, out translationVector );
}
estimatedTransformationMatrixControl.SetMatrix(
Matrix4x4.CreateTranslation( translationVector ) *
Matrix4x4.CreateFromRotation( rotationMatrix ) );
float estimatedYaw;
float estimatedPitch;
float estimatedRoll;
rotationMatrix.ExtractYawPitchRoll( out estimatedYaw, out estimatedPitch, out estimatedRoll );
estimatedYaw *= (float) ( 180.0 / Math.PI );
estimatedPitch *= (float) ( 180.0 / Math.PI );
estimatedRoll *= (float) ( 180.0 / Math.PI );
estimatedYawBox.Text = estimatedYaw.ToString( "F3" );
estimatedPitchBox.Text = estimatedPitch.ToString( "F3" );
estimatedRollBox.Text = estimatedRoll.ToString( "F3" );
estimatedXObjectBox.Text = translationVector.X.ToString( "F3" );
estimatedYObjectBox.Text = translationVector.Y.ToString( "F3" );
estimatedZObjectBox.Text = translationVector.Z.ToString( "F3" );
}
}