Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have done this, where a doctors frame is projected onto the patients frame, but with the whole skeleton this doesn't work so well because of different bone heights :/. The code can be found <a href="https://gist.github.com/3094052" rel="nofollow noreferrer">here</a>. <em>It is in beta 2 code, the more current version can be found <a href="https://gist.github.com/3094082" rel="nofollow noreferrer">here</a>, although it is not currently working perfectly</em></p> <p>As for comparing, do something like this</p> <pre><code>for (int i = 0; i &lt; patientList.Count; i++) { int diff = (int)Math.Abs(patientList[i] - doctorList[i]); if (diff &lt; 100) //or whatever number you want { Debug.WriteLine("Good Job"); } } </code></pre> <p>I have abandoned the idea of a whole figure because of the bone heights mentioned by Fixus, so my current program looks some thing like: <img src="https://i.imgur.com/ddcd1.png" alt="image"></p> <p><strong>EDIT</strong></p> <p><em>This is the concept of camparing two movements with kinect and calculate a similarity between the two movements I explain in depth.</em></p> <p>Suppose I have the following 2 points, point A (0, 0, 0) and point B (1, 1, 1). Now I want to find the difference from point A to B, so I would subtract all of the X, Y, and Z numbers, so the difference is 1 X 1 Y 1 Z. That is the simple stuff. Now to implement it. The code I have written above, <strong>I</strong> would implement like this.</p> <pre><code>//get patient hand coordinates double patienthandX = Canvas.GetLeft(patienthand); double patienthandY = Canvas.GetTop(patienthand); //get doctor hand coordinates double doctorhandX = Canvas.GetLeft(doctorhand); double doctorhandY = Canvas.GetTop(doctorhand); //compare difference for each x and y //take Absolute value so that it is positive double diffhandX = Math.Abs(patienthandX - doctorhandX); double diffhandY = Math.Abs(patienthandY - doctorhandY); </code></pre> <p>Now here comes another issue. The doctor coordinates are always the same, but what if the patient isn't standing where the doctor coordinates were recorded? Now we implement more simple math. Take this simple example. suppose I want point A(8, 2) to move to point B(4, 12). You multiply the x and y's of A to get to B. So I would multiply the X by .5, and the Y by 6. So for Kinect, I would put a element on the patients hip, then compare this to the doctors hip. Then multiply <strong>all</strong> of the doctor joints by that number to achieve the doctor joints on top of the patients (more or less). For example</p> <pre><code>double whatToMultiplyX = (double) doctorhipX / patienthipX; double whatToMultiplyY = (double) doctorhipY / patienthipY; </code></pre> <p>This is all pretty simple, but bringing it together is the harder part. So far we, 1) Scale the doctor frames on top of the patient frames, 2) Calculate the difference. 3) Compare the difference throughout the entire rep. and 4) Reset for the next rep. This seems simple but it is not. To calculate the entire difference for the rep, do something like this:</p> <pre><code>//get patient hand coordinates double patienthandX = Canvas.GetLeft(patienthand); double patienthandY = Canvas.GetTop(patienthand); //get doctor hand coordinates double doctorhandX = Canvas.GetLeft(doctorhand); double doctorhandY = Canvas.GetTop(doctorhand); //compare difference for each x and y //take Absolute value so that it is positive double diffhandX = Math.Abs(patienthandX - doctorhandX); double diffhandY = Math.Abs(patienthandY - doctrorhandY); //+= so that it keeps adding to it. totaldiffhandX += diffhandX; totaldiffhandY += diffhandY; </code></pre> <p>Now we can compare, and say:</p> <pre><code>if (totaldiffhandX &lt; 1000 &amp;&amp; totaldiffhandY &lt; 1000) //keep numbers pretty high since it is an entire rep { //reset difference totaldiffhandX = 0; totaldiffhandY = 0; //tell the patient good job Debug.WriteLine("Good Job"); } </code></pre> <p>This is pretty easy, but keep in mind you <strong>must do this for every single joint's x and y</strong>. Otherwise it will not work. Hope this Helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload