I have an skeleton scaled to a fixed height in screen( 2/3ths of the screen) , now I want to scale the image(with background substraction) to match that skeleton. I am using this method below to find out the target distance to get a fixed height in screen( no matter how far or near the user is), then I compute a vertical translation to get the skeleton with the foot joints on the bottom of the image.
void KinectClass::ScaleJoints(){
//Target Height in screen
double targetAdultHeightScreen = windowHeight*5/6;
double originalAdultDistance = players[0].hipCenter.z;
// Original Height in Screen
originalHeightScreenAdult = SkeletonToScreen(players[0].rightFoot, windowWidth, windowHeight).y - SkeletonToScreen(players[0].head, windowWidth, windowHeight).y;
// Target distance to get target height
AdultscaleDistance = originalHeightScreenAdult * originalAdultDistance/ targetAdultHeightScreen;
//New headJoint scaled to compute vertical translation
Vector4 headJointAdult = {players[0].head.x ,players[0].head.y , AdultscaleDistance,players[0].head.w};
//Vertical translation
transAdult = windowHeight/6 - SkeletonToScreen(headJointAdult, windowWidth, windowHeight).y;
scaleRatioAdult = originalHeightScreenAdult/targetAdultHeightScreen;
}
Something like this:
Now I have to scale the bitmap image (that now is the size of the screen) so my skeleton match with the image.
D2D1_SIZE_F screenSize = renderTarget_->GetSize();
//D2D1_RECT_F rec = D2D1::RectF(0, 0, screenSize.width, screenSize.height);
The problem is that now I have to scale the image to match the skeleton which has not only the user but the entire scene(color stream of the kinect).
Which transformations do I have to apply to that bitmap?