none
Using a ListView to display joints coordinates RRS feed

  • Question

  • Hello, 

    I'm developping an application with Kinect but i'm not too familiarised with c#.

    Here is my question:

    when i detect a skeleton in the room i want to determinate the coordinates of each tracked joint (normally there are 20 joints) and i want to display these coordinates into a ListView. 
    So there will be 4 colomns:
    The first one is the type of joint, and then the coordinates x, y, and z.

    listview

    I wrote this code to store the joint coordinates, but i don't know how to display it respctively from  
    the JointCordinates List in order(x,y, z) !! :(

    // searching for a skeleton
    
          if (first == null) // if no skeleton detected
                {
                    txtP.Text = "No skeleton"; 
                    return;
                }
    
                else
                {
                    txtP.Text = "Skeleton Detected";
    
                    /// define joints
                                    
    
                                    Joint H = first.Joints[JointType.Head]; // head
    
                                    Joint SC = first.Joints[JointType.ShoulderCenter]; // shouldercenter
                                    Joint SL = first.Joints[JointType.ShoulderLeft]; // shoulder Left
                                    Joint SR = first.Joints[JointType.ShoulderRight]; // soulderRight
    
                                    Joint EL = first.Joints[JointType.ElbowLeft];
                                    Joint ER = first.Joints[JointType.ElbowRight];
                                    Joint WL = first.Joints[JointType.WristLeft];
                                    Joint WR = first.Joints[JointType.WristRight];
                                    Joint HandL = first.Joints[JointType.HandLeft];
                                    Joint HandR = first.Joints[JointType.HandRight];
    
                                    Joint Spine = first.Joints[JointType.Spine];
    
                                    Joint HipC = first.Joints[JointType.HipCenter];
                                    Joint HipL = first.Joints[JointType.HipLeft];
                                    Joint HipR = first.Joints[JointType.HipRight];
    
                                    Joint KL = first.Joints[JointType.KneeLeft];
                                    Joint KR = first.Joints[JointType.KneeRight];
    
                                    Joint AnkL = first.Joints[JointType.AnkleLeft]; 
                                    Joint AnkR = first.Joints[JointType.AnkleRight];
                                    Joint FL = first.Joints[JointType.FootLeft];
                                    Joint FR = first.Joints[JointType.FootRight];
                    JointList.Add(H);
                    JointList.Add(SC);
                    JointList.Add(SL);
                    JointList.Add(SR);
                    JointList.Add(Spine);
                    JointList.Add(EL);
                    JointList.Add(ER);
                    JointList.Add(HandL);
                    JointList.Add(HandR);
                    JointList.Add(HipC);
                    JointList.Add(HipR);
                    JointList.Add(HipL);
                    JointList.Add(KL);
                    JointList.Add(KR);
                    JointList.Add(AnkL);
                    JointList.Add(AnkR);
                    JointList.Add(FL);
                    JointList.Add(FR);
                    JointList.Add(WL);
                    JointList.Add(WR);
    
                    foreach (Joint j in JointList)
                    {
                        if (j.TrackingState == JointTrackingState.Tracked)
    
                        jx = j.Position.X;
                        jy = j.Position.Y;
                        jz = j.Position.Z;
                        JointsCordinates.Add(jx);
                        JointsCordinates.Add(jy);
                        JointsCordinates.Add(jz);
    
    
                      // JointsCordinates.ForEach(joint => ListView.Columns.Add(joint));
    
    
    
                    }
                }
                   
    


    I saw other links, and they suggest to use  "ListView.Columns.Add" but i get: "Error 2 'System.Windows.Controls.ListView' does not contain a definition for 'Columns' and no extension method 'Columns' accepting a first argument of type 'System.Windows.Controls.ListView' was found (a using directive or an assembly reference missing it)" 
    i used reference system.window.forms but i still have the same error.


    Do you have an idea how to solve this ??
    thanks for any help.

    Regard


    DKF

    Friday, July 19, 2013 12:19 PM

Answers