How to control Get3DShape() in Microsoft Kinect face tracking SDK?

I'm working on a lip-reading project and I'm using Microsoft Kinect face tracking SDK in order to extract lip features in a generated text file from C# to be processed in MATLAB. The features are 29 angles resulting after calculating the distances between
the 18 feature points related to the lips using Get3DShape() function to get the co-ordinates in each frame and my code looks like that which I added in facetrackingviewer.cs:
public void getangles(FaceTrackFrame fr)
var shape = fr.Get3DShape();
var X_7 = shape[FeaturePoint.MiddleTopDipUpperLip].X;
var Y_7 = shape[FeaturePoint.MiddleTopDipUpperLip].Y;
var Z_7 = shape[FeaturePoint.MiddleTopDipUpperLip].Z;
var X_31 = shape[FeaturePoint.OutsideRightCornerMouth].X;
var Y_31 = shape[FeaturePoint.OutsideRightCornerMouth].Y;
var Z_31 = shape[FeaturePoint.OutsideRightCornerMouth].Z;
var X_33 = shape[FeaturePoint.RightTopDipUpperLip].X;
var Y_33 = shape[FeaturePoint.RightTopDipUpperLip].Y;
var Z_33 = shape[FeaturePoint.RightTopDipUpperLip].Z;
var X_40 = shape[FeaturePoint.MiddleTopLowerLip].X;
var Y_40 = shape[FeaturePoint.MiddleTopLowerLip].Y;
var Z_40 = shape[FeaturePoint.MiddleTopLowerLip].Z;
var X_41 = shape[FeaturePoint.MiddleBottomLowerLip].X;
var Y_41 = shape[FeaturePoint.MiddleBottomLowerLip].Y;
var Z_41 = shape[FeaturePoint.MiddleBottomLowerLip].Z;
var X_64 = shape[FeaturePoint.OutsideLeftCornerMouth].X;
var Y_64 = shape[FeaturePoint.OutsideLeftCornerMouth].Y;
var Z_64 = shape[FeaturePoint.OutsideLeftCornerMouth].Z;
var X_66 = shape[FeaturePoint.LeftTopDipUpperLip].X;
var Y_66 = shape[FeaturePoint.LeftTopDipUpperLip].Y;
var Z_66 = shape[FeaturePoint.LeftTopDipUpperLip].Z;
//some stuff
float[] point1 = new float[3] { X_7, Y_7, Z_7 };
float[] point2 = new float[3] { X_64, Y_64, Z_64 };
float[] point3 = new float[3] { X_41, Y_41, Z_41 };
float[] point4 = new float[3] { X_80, Y_80, Z_80 };
float[] point5 = new float[3] { X_88, Y_88, Z_88 };
float[] point6 = new float[3] { X_31, Y_31, Z_31 };
float[] point7 = new float[3] { X_87, Y_87, Z_87 };
float[] point8 = new float[3] { X_40, Y_40, Z_40 };
float[] point9 = new float[3] { X_89, Y_89, Z_89 };
float[] point10 = new float[3] { X_86, Y_86, Z_86 };
float[] point11 = new float[3] { X_85, Y_85, Z_85 };
float[] point12 = new float[3] { X_82, Y_82, Z_82 };
float[] point13 = new float[3] { X_84, Y_84, Z_84 };
float[] point14 = new float[3] { X_66, Y_66, Z_66 };
float deltax = point2[0] - point1[0];
float deltay = point2[1] - point1[1];
float deltaz = point2[2] - point1[2];
float cetax = point3[0] - point2[0];
float cetay = point3[1] - point2[1];
float cetaz = point3[2] - point2[2];
float notex = point3[0] - point1[0];
float notey = point3[1] - point1[1];
float notez = point3[2] - point1[2];
float deltax1 = point5[0] - point4[0];
float deltay1 = point5[1] - point4[1];
float deltaz1 = point5[2] - point4[2];
float deltax2 = point5[0] - point3[0];
float deltay2 = point5[1] - point3[1];
float deltaz2 = point5[2] - point3[2];
//some stuff
float distance = (float)
Math.Sqrt((deltax * deltax) + (deltay * deltay) + (deltaz * deltaz));
float distance1 = (float)
Math.Sqrt((cetax * cetax) + (cetay * cetay) + (cetaz * cetaz));
float distance2 = (float)
Math.Sqrt((notex * notex) + (notey * notey) + (notez * notez));
float distance3 = (float)
Math.Sqrt((deltax1 * deltax1) + (deltay1 * deltay1) + (deltaz1 * deltaz1));
float distance4 = (float)
Math.Sqrt((deltax2 * deltax2) + (deltay2 * deltay2) + (deltaz2 * deltaz2));
float distance5 = (float)
Math.Sqrt((deltax3 * deltax3) + (deltay3 * deltay3) + (deltaz3 * deltaz3));
float distance6 = (float)
Math.Sqrt((deltax4 * deltax4) + (deltay4 * deltay4) + (deltaz4 * deltaz4));
float distance7 = (float)
Math.Sqrt((deltax5 * deltax5) + (deltay5 * deltay5) + (deltaz5 * deltaz5));
float distance9 = (float)
Math.Sqrt((deltax6 * deltax6) + (deltay6 * deltay6) + (deltaz6 * deltaz6));
float distance8 = (float)
Math.Sqrt((deltax7 * deltax7) + (deltay7 * deltay7) + (deltaz7 * deltaz7));
//some stuff
double feature = CalcAngleB(distance, distance2, distance1);
double feature2 = CalcAngleB(distance2, distance, distance);
double feature3 = CalcAngleB(distance, distance1, distance2);
double feature4 = CalcAngleB(distance3, distance5, distance4);
double feature5 = CalcAngleB(distance5, distance4, distance3);
double feature6 = CalcAngleB(distance4, distance3, distance5);
double feature7 = CalcAngleB(distance6, distance, distance7);
double feature8 = CalcAngleB(distance10, distance8, distance9);
double feature9 = CalcAngleB(distance9, distance10, distance8);
double feature10 = CalcAngleB(distance8, distance9, distance10);
//some stuff
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"D:\angles.txt", true))
file.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28}", feature, feature2, feature3, feature4, feature5, feature6, feature7, feature8, feature9, feature10, feature11, feature12, feature13, feature14, feature15, feature16, feature17, feature18, feature19, feature20, feature21, feature22, feature23, feature24, feature25, feature26, feature27, feature28, feature29);
Where CalculateAngleB is a declared function above:
public double CalcAngleB(double a, double b, double c)
return Math.Acos((a * a + c * c - b * b) / (2 * a * c));
and I call getangles(fr) at :
internal void OnFrameReady(KinectSensor kinectSensor, ColorImageFormat colorImageFormat, byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage, Skeleton skeletonOfInterest)
this.skeletonTrackingState = skeletonOfInterest.TrackingState;
if (this.skeletonTrackingState != SkeletonTrackingState.Tracked)
// nothing to do with an untracked skeleton.
return;
if (this.faceTracker == null)
try
this.faceTracker = new FaceTracker(kinectSensor);
catch (InvalidOperationException)
// During some shutdown scenarios the FaceTracker
// is unable to be instantiated. Catch that exception
// and don't track a face.
Debug.WriteLine("AllFramesReady - creating a new FaceTracker threw an InvalidOperationException");
this.faceTracker = null;
if (this.faceTracker != null)
FaceTrackFrame frame = this.faceTracker.Track(
colorImageFormat, colorImage, depthImageFormat, depthImage, skeletonOfInterest);
getangles(frame);
this.lastFaceTrackSucceeded = frame.TrackSuccessful;
if (this.lastFaceTrackSucceeded)
if (faceTriangles == null)
// only need to get this once. It doesn't change.
faceTriangles = frame.GetTriangles();
//MessageBox.Show("face has been detected");
this.facePoints = frame.GetProjected3DShape();
//this.FaceRect = new System.Windows.Rect(frame.FaceRect.Left, frame.FaceRect.Top, frame.FaceRect.Width, frame.FaceRect.Height);
Now, whenever the mask appears as if (this.facetracker!=null), the code starts to calculate the angles and generate the text file. My question is how can I add a control (e.g.Timer or button) to decide exactly when to start calculating features or generating
the file because in data collection I need features to be recorded accurately when the speaker starts to pronounce phrases not when the mask appears. I have tried to add a dispatcherTimer as when the timer counts after the mask appears it starts to calculate
the angles like this:
private static void dispatcherTimer_Tick(object sender, EventArgs e)
Microsoft.Kinect.Toolkit.FaceTracking.FaceTrackFrame fr;
fr = facetracker.Track(sensor.ColorStream.Format, colorPixelData,
sensor.DepthStream.Format, depthPixelData,skeleton);
//getangles(fr) and stream writter
and added this to getangles(fr)
System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += dispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
dispatcherTimer.Start();
but this gives an error in: var shape = frame.Get3DShape(); as using unassigned variable frame and I tried to declare facetracker in timer's void but this gives me an error too so, if you have an I idea how can I add a timer or a button to control when the
angles to be calculated I would be grateful.
Thanks in advance.

Hi Mesbah15,
I am not sure if I’ve understood the question correctly. You can try using event to communicate with other classes. Define an event, when mask appears you just need call that event handler.
https://msdn.microsoft.com/en-us/library/17sde2xt(v=VS.100).aspx.
Please post more information about your scenario for better understanding if event handler not help.
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Disabling face tracking on webcam - S405

    Does anyone know how to disable or turn off the face tracking feature (on the webcam) on the S405? I see it uses quite a bit of CPU resources. The only way I can turn it off is by killing it in the task manager. Then it comes back after a reboot. I want to permanently disable it. Called Lenovo, they were no help at all.

    Maybe you can try uninstall and reinstall the software.

  • CRM Web UI :- How to Control number of session of Web UI for a user

    Hello Experts,
    We do have very specific requirement which SAP doesn`t recommend in terms of multi-sessioning for a user.So we are little worried upon the challeges.Could you please share your ideas/Experience on following?
    1.How to Control number of Internet explorer session for the web UI (may be 2 or 3).?
      Though SAP doesn`t recommned more than one but our client requires 2 or more than that but we need to fix it either 
      2 or 3.
      So we are looking for specific setting for this.
    2.What are the challenges we need to face if we implement option 1?
    3.Specially in interaction record management
        a. Is there chance of loosing the data if agent has opened more than two session.
        b. In which session interaction record data will get stored,the one on which agent picked up the call or in the latest 
            one?
    Please let me know if I am not clear enough on any point.
    Thanks in advance,
    Shailendra Tolambiya

    Hi Shailendra,
    The following wiki page might be useful in this respect:
    http://wiki.sdn.sap.com/wiki/x/gxdKDQ
    Best Regards,
    Shiromani

  • Using the Microsoft Kinect for Position Tracking in LabVIEW

    Hi,
    I am currently working on a project to take 2-D ultrasound images and reconstruct them into a 3-D image for a physician to use. In this project, we need to be able to know the relative position of the ultrasound probe in order to connect the 2-D images to their position on the part of the body being imaged.
    My current plan is to utilize the Microsoft Kinect in LabVIEW to track the ultrasound probe as it takes 2-D images, in order to later organize the images by position.
    Can anyone point me in the right direction for this task? I have found many different utilities for LabVIEW use of the Kinect, but I am specifically looking to track one single point as it moves a short distance. I could even put a red ball on the end of the probe, and have the Kinect only track the movement of that red ball.
    Any help with this task, or any integration of the Kinect with LabVIEW would be a great help,
    Boutros

    Hello all,
    I wanted to update everyone on how our project is coming, and for some further help.
    We have followed some of the work of this group: https://decibel.ni.com/content/docs/DOC-16978
     and have tested a large portion of their code. The benefit of this project is that they have isolated individual limbs to be tracked by the Kinect. So, we can choose to isolate and track the "right arm" if the pysician is using the ultrasound probe in that arm.
    We have tested the code and it is working sucesfully. The only problem is then we are unsure of how to export the position data into our reconstruction code. We want to take the position data acquired by this LabVIEW routine AS IT IS SAMPLED IN THE TIME DOMAIN, and export it for use in the reconstruction of the 2D ultrasound images. I am unsure of how to take this data, whcih is provided in realtime, and store it as sampled position data points in time.
    Please let me knwo if any clarification is needed of my issue, or the project in general.
    Any help would be greatly appreciated,
    Peter

  • EXE file can not ins microsoft.kinect.dll file

    I develope a labview project about using kinect to make some guesture control. The project itself can run with no problem, but when I create a EXE file for this project as a application, the program will always search for Microsoft.kinect.dll file, I really have no idea what happened to this?Can someone help me to figure out where the problem is?Thanks in advance.

    I need help in this too. can anyone help please. 

  • HOW TO CONTROL ON CREATION OF SALES ORDER WITH REFERENCE TO EARLIER SO?

    Dear All,
    I want to contol on creation of Sales order with reference to earlier SO?  While creation of sales order our enduser are creating sales order with reference to earlier month SO which I want to restrict. Recently I made changes in sales order like payment terms is grayed, system will atomatically pick pay terms from customer master.Now I am getting correct data also but enduser is using old SO no while creating new SO and old payment data is reflecting in fbl5n.
    I want to restrict enduser while creating new SO with ref. to old SO. Only for returns they should be able to use Billing refrence. Pl. suggest how to control the with reference to ealier SO.
    Nikhil

    Nikhil Deshpande,
          If you dont want allow create a sales order in referent to other one, just delete the copy control between these sales order type, so when the user tries to create a SO in reference to other one a message is displayed that is not possible.
    Thanks,
    Mariano.

  • How to control my MacBook Pro with my iPhone ?

    I do wanna know how to control my Macbook pro just with my iPhone, please

    If you mean copy files from one to the other you can connect the two via firewire cable and boot one into Target Disk Mode.

  • How to control follow up doc for  Activities

    Hi...
    I have created 10 different types of Activitiy Doc. When I open any activity in crmd_order I'm getting all other activities as follow up docs(when I click on follow up icon). I dont want all of them, may be I need one or two out of those. How to control those can anyone have idea
    Regards,
    Ajay

    Hi,
    Check the copy control for transactions in
    spro-->Customer Relationship Management->Transactions->Basic Settings->Copying Control for Business Transactions->Define Copying Control for Transaction Types
    If the transactions are maintained as follow up for the transaction you have created then remove the entries which you dont want as follow up.
    Reward points if it helps.
    Shridhar

  • How to control DE USB disk Automounts.

    Hi,
    Can someone please guide me as to how to 'control' Automounts by DE when we plug USB disk drives.
    I have KDE4 on my Arch system. When I connect a pen drive/USB HDD which is formatted as vfat/NTFS, the system(or KDE) 'Automounts' it in /media and I have read/write access to it. But if I use the same drive and format it as ext4, it wont be mounted as read/write for normal users but only for root.
    Now pen drives and USB HDD's are removable storage drives and hence are volatile and could not have a fixed mount point, so it cannot be mounted by putting an entry in fstab or could they?. And I need my USB HDD frequently, and manually mounting it through CLI everytime and working on it as root is a bad idea i guess.
    I am posting this because m confused as to how to control this Automount feature-What is the backend to it? Because I've read that HAL no longer takes care of it and that HAL will be deprecated soon, instead UDEV takes care of it. If that is the case then should I be concerned about polkit? Because that is what's the output provided by Dolphin(freedesktop.org policy prevented blah blah).
    Another thing is if HAL is still in use and Automounts my devices then is it independent or polkit is a part of it. Then, is using hal-easy an option or replacement to standard HAL. ??!!??
    I tried HAL archwiki and used the code to give a user permission to give rw access to automounted ext filesystems, but then nothing is mounted, it sings the same old freedesktop.org prevented bla blah song. And I think this is a question for all linuxes using Gnome and KDE in general.
    Any help is appreciated.

    If by 'ability to mount as user' you mean to mount it manually but read/write access to normal users then yes. But primarily I need automounting as user, also be able to give access to other users for read/write et filesystem automounts.
    Last edited by kapz (2009-11-17 01:12:56)

  • I'm using 9.2.1.  Every time I open an album, I get a "face (the same one)" covering every picture. If I click on the picture, I can see the real picture.  How do I get rid of this "face" that covers all?

    I'm usingiPhoto 9.2.1.  Recently, everytime I open an album, I get a "face (the same one)" covering every picture. If I click on the picture, I can see the real picture.  How do I get rid of this "face" that covers all?

    Make a temporary backup of your library (if you don't already have a backup of it) and launch iPhoto with the Command +Option key held down and rebuild the library with options #1, 2, 3 and 6 selected.
    OT

  • How can I stop iPhoto from reidentifying faces I have already 'crossed', while still being able to identify and sort new faces.

    iPhoto has detected faces of people I dont know, in my 'iPhoto faces' whenever I click the cross in the corner of the face (when sorting faces) the face temporarily disappears, but once I have uploaded a fresh batch of photos (and want to identify new faces) it automatically re-identifies the old photos that I don't want to have to sort again. How can I stop iPhoto from reidentifying faces I have already 'crossed', while still being able to identify and sort new faces.

    Thank you, that makes sense (I think!) However, I need to be able to tell iPhoto who the people identified in my photos are, does that make sense? How do I identify the people in my new photos without clicking 'find faces'. I know that button searches through my photos to find faces, but it also gets me to the place where I identify the faces as my friends and family, is there a shortcut to get to that place without clicking 'find faces'? That is what I really need, please help!!

  • How can I sync my Microsoft Outlook tasks with my Ipad reminders? I dont want to use Icloud or an exchange

    How can I sync my Microsoft Outlook tasks with my Ipad reminders? I dont want to use Icloud or an exchange

    Plug it into your computer. Tell it to sync with "this computer" instead of iCloud. You shouldn't have to remove any apps. Otherwise, you can save the app data by using i-FunBox ( http://www.i-funbox.com/ ) just go to the "devices" tab and select 'user applications' and select all of your apps and tell iFunBox to "copy to pc" you're done! You have them all backed up.

  • How can I change a Microsoft Word document file into a picture file?

    How can I change a Microsoft Word document file into a picture or jpeg file? I am wanting to make the image I created my background on my macbook pro.

    After I had the document image the way I wanted it, I saved it as a web page and went from there. Below are the steps starting after I did the "save as" option in Word:
    1) Select "Save As Web Page". I changed the location from documents to pictures when the window came up to save it as a web page.
    2) Go to "Finder" on you main screen, or if it's on your main toolbar at the bottom.
    3) Click on the "Pictures" tab and find the file you just re-saved as a web page. (I included "web page" or something similar in the new title so I could easily find the correct file I was looking for)
    4) Open the correct file and then "right click" on the actual image. (Use 2 fingers to do so on a Mac)
    5) Select 'Use Image As Desktop Picture", and voilà! The personally created image, or whatever it is that you wanted, is now your background.
    **One problem I encountered while doing this is that the image would show up like it was right-aligned in relation to the whole screen. The only way I could figure how to fix this was to go back to the very original document in Word, (the one before it was saved as a web page), and move everything over to the left.
    I hope this helps someone else who was as frustrated as I was with something that I thought would have been very simple to do! If you have any tips or suggestions of your own, please feel free to share. : )

  • How to control a NI USB 6210 from a Lab View program?

    Hi,
    I started today with Lab View with some earlier experience long ago.
    While it took me only about half an hour to get my first program running (great), installation time nor included (of course), I meanwhile read documents for some hours and cannot find out how to control measurement hardware in Lab View.
    I want to use a USB 6210 to set a 1-bit digital port. But at the moment there is no USB6210 available so I wanted to write (or do you say draw ?) the program without it and if possible simulate the hardware.
    I drew DAQ Assistant into my block diagram and selected digital line output but get "No supported devices found". I don't know if the appropriate driver was installed during Lab View installation.
    Also I don't understand the mechanism between DAQmx, tasks and the real hardware. Now I have a "Digital Bool 1Line 1Point" Control in my block diagram. How do signals get from program flow to hardware pin? How can I create a simulation for not connected hardware?
    Any help is greatly welcome
    Thanks a lot
    Martin

    Okay here is some more tutorials if you get some free time, specifically the hardware stuff will be relavent.
    NI Learning Center
    NI Getting Started
    -Hardware Basics
    -LabVEW Basics
    -DAQ Application Tutorials
    3 Hour LabVIEW Introduction
    6 Hour LabVIEW Introduction
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Launch MAX, it was known as Measurement and Automation Explorer, there should be a shortcut in your start menu / desktop.  Under devices and interfaces you can find your hardware and open test panels to control it.  This is the first place to ensure your hardware is working.  If the device isn't seen you'll need to install the drivers and DAQmx software.  If it is there, great.
    Now launch LabVIEW.  The easiest way to control hardware is using the DAQ Assistant.  It has many limitations and isn't recommended for large applications.  But for something quick and dirty it works fine.  You'll find it under the Measurement I/O >> NI DAQmx palette on the block diagram.  If it isn't there you may need to reinstall the DAQmx drivers.  This can happen if you installed DAQmx before LabVIEW.
    Also you'll find under Help >> Find Examples on the toolbar, many examples on controlling hardware.  Feel free to post some code if  you are having problems.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to control the shared libs when creating an new OC4J  in AS 10.1.3.4

    Hi there
    I experience some wired behavior in AS 10.1.3.4!
    I Have 2 different installation of AS 10.,1.3.4 (Win 2003 server).
    When I create an OC4J instance (using the manager) at virtual server 1 I got 28 global libraries
    When I create an OC4J instance (using the manager) at virtual server 2 I got 30 global libraries, (+ apache.webservices & oracle.ifs.client )
    Why this difference ?
    And how to control it?
    Note the default instance "Home" has 28 libraries on both servers!!
    Why is it sometime possible possible to use <instance>applib for the jar, and sometime I need to create an <instance>\shared-lib\global.libraries\1.0 library ?
    Regards HAns

    Hi there
    I experience some wired behavior in AS 10.1.3.4!
    I Have 2 different installation of AS 10.,1.3.4 (Win 2003 server).
    When I create an OC4J instance (using the manager) at virtual server 1 I got 28 global libraries
    When I create an OC4J instance (using the manager) at virtual server 2 I got 30 global libraries, (+ apache.webservices & oracle.ifs.client )
    Why this difference ?
    And how to control it?
    Note the default instance "Home" has 28 libraries on both servers!!
    Why is it sometime possible possible to use <instance>applib for the jar, and sometime I need to create an <instance>\shared-lib\global.libraries\1.0 library ?
    Regards HAns

Maybe you are looking for

  • Bootcamp 3.1 & Windows 7 x64 - no external sound input, low speakers level

    Hi all, I just installed long awaited Bootcamp 3.1 update. I am rather disappointed. The only thing that has changed is that the red light on the audio output is off. This thing actually bothered me the least. External sound input line does not seem

  • Waking up a Mac Pro through the network?

    I am using my macpro to share files to a macbook pro. after a period of inactivity, the macpro goes to sleep and I am no longer able to access it from my macbook pro. Is there a way to wake up the mac pro without having to physically touch it? Thanks

  • Ultra 10 OBP can't see SCSI drives

    I'm trying to get my Ultra 10 to boot off a SCSI drive. I've tried several controllers (SYM21002, SYM21003, and another 53c896 card) and several drives, but probe-scsi-all returns nothing. If I boot off an install CD (the CD drive is still IDE), I ca

  • Dynamic Security username () problems

    Hi, I need some help with the following situation. I am trying to put into place asome sort of dynamic Security in my cube. With some help , I manage to get something working: select [Measures].[Sales Net Amount] on columns,  NONEMPTY(     [Dim Resta

  • Nomad jukebox 3 sticking power swi

    Hi, Can anybody tell me the cure for a sticky on/off switch? If i need too I will take the thing apart and clean the switch. It isn't under warranty anyway, but I only found one screw and it's in behind the battery cover plate. Can somebody help me g