0

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:

Scaled Skeleton

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?

4

1 回答 1

0

这种转换的关键是对每个骨架关节使用以下映射函数:

public ColorImagePoint MapSkeletonPointToColorPoint(SkeletonPoint skeletonPoint, ColorImageFormat colorImageFormat);

将所有关节转换到颜色平面后,您可以在颜色位图上执行任何您想要的缩放,并且只需在转换后的骨架颜色点上执行完全相同的缩放。

于 2014-05-27T11:43:15.653 回答