0
votes

I am doing one project on kinect with windows SDK. I am trying to display the image on skeleton shoulder with the following code. **

Xaml code

<Canvas Margin="250,0,0,0" Visibility="{Binding Path=Showcamera, Converter={StaticResource BVC}}" Background="Green" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Column="1" Grid.Row="1">

        <Image MaxHeight="600" MaxWidth="950" x:Name="PART_KinectVideo"  Visibility="{Binding Path=Showcamera, Converter={StaticResource BVC}}"  />
        <Canvas>
        <Image  RenderOptions.BitmapScalingMode="HighQuality" Visibility="{Binding Path=Showcamera, Converter={StaticResource BVC}}"
            RenderOptions.EdgeMode="Aliased"  Canvas.Top="60" Canvas.Left="350"  Stretch="Uniform" x:Name="Jewel"/>
        </Canvas>

Code Behind

var j1p = nui.MapSkeletonPointToDepth(closestSkeleton.Joints[JointType.ShoulderLeft].Position,DepthImageFormat.Resolution640x480Fps30);

 Canvas.SetLeft(Jewel, j1p.X+90);
 Canvas.SetTop(Jewel, j1p.Y-280);

by getting the j1p values i am trying to set the left and top position of the canvas for the Jewel image object.

Problem with the code is :

This is not correctly placing the image. When the user moves in the screen the image also moves out of body with left and right direction as user moves.

I need the image should be set to the position even when the user moves right or left.
How should I alter the code or is there any sample available to set the image in particular position of the kinect joints?

1

1 Answers

0
votes

Maybe try this:

var left = (double)image.GetValue(Canvas.LeftProperty)
left += 90;
image.SetValue(Canvas.LeftProperty, left);

I wrote an app using that code and everything worked fine to me:)