<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Could you attach your in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019534#M37590</link>
    <description>&lt;P&gt;Could you attach your &lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;RSHandler.cs&lt;/SPAN&gt;&amp;nbsp;code? Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2015 18:39:21 GMT</pubDate>
    <dc:creator>Xusheng_L_Intel</dc:creator>
    <dc:date>2015-10-15T18:39:21Z</dc:date>
    <item>
      <title>Facial Expression done, but optimization issue!</title>
      <link>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019533#M37589</link>
      <description>&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;Someone please help, It is urgent! &lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;Now that I have face animation based on emotion done, I have optimization issue.&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;The framerate drops severely when I turn on RSHandler.cs and SenseToolkitManager.cs. The most bottleneck seems to be happening from RSHandler.cs's Update() which I pasted below. (Also attached for RSHandler.cs code)&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;I am wondering if it(blue text) is correct way to get emotion data. It doesn't make sense to Init in every Update(), but when I take the sm.Init(); out, the emotion tracking doesn't work. If it is in the Update, it works but uses up 99% of the CPU.&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;Am I missing something?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; background-color: rgb(227, 243, 255);"&gt;Thanks!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Priya&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 05:04:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019533#M37589</guid>
      <dc:creator>Priyadhars_K_Intel</dc:creator>
      <dc:date>2015-10-15T05:04:12Z</dc:date>
    </item>
    <item>
      <title>Could you attach your</title>
      <link>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019534#M37590</link>
      <description>&lt;P&gt;Could you attach your &lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;RSHandler.cs&lt;/SPAN&gt;&amp;nbsp;code? Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 18:39:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019534#M37590</guid>
      <dc:creator>Xusheng_L_Intel</dc:creator>
      <dc:date>2015-10-15T18:39:21Z</dc:date>
    </item>
    <item>
      <title>Quote:David Lu (Intel) wrote:</title>
      <link>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019535#M37591</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;David Lu (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Could you attach your RSHandler.cs&amp;nbsp;code? Thanks!&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Here it is.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;using UnityEngine;
using System.Collections;
using RSUnityToolkit;

public class RSHandler : MonoBehaviour {


    public static bool oneHandDetected = false;
    public GameObject RSImage;
    

    InGameUIPanelManager UIPM;
    PXCMSenseManager sm;
    FaceTrackingRule _faceTrackingRule = null;


    BlendShapeTarget BSTarget_surprise;
    BlendShapeTarget BSTarget_negative;
    BlendShapeTarget BSTarget_positive;


    pxcmStatus emotionFrame;
    PXCMEmotion em;

    PXCMEmotion.EmotionData emotion_surprise;
    PXCMEmotion.EmotionData emotion_negative;
    PXCMEmotion.EmotionData emotion_positive;



    // Use this for initialization
    void Start () {


        UIPM = FindObjectOfType&amp;lt;InGameUIPanelManager&amp;gt;();
        sm = PXCMSenseManager.CreateInstance();
        


        sm.EnableEmotion();
        
        
        RSImage.SetActive(false);
        
        BSTarget_surprise = FindObjectOfType&amp;lt;ann_blendshapeLinker&amp;gt;().blendShapeTargetScripts[0];
        BSTarget_negative = FindObjectOfType&amp;lt;ann_blendshapeLinker&amp;gt;().blendShapeTargetScripts[1];
        BSTarget_positive = FindObjectOfType&amp;lt;ann_blendshapeLinker&amp;gt;().blendShapeTargetScripts[3];
        
    }


    // Update is called once per frame
    void Update () {

        if (Input.GetKeyDown(KeyCode.I))
        {
            RSImage.SetActive(!RSImage.activeSelf);
        }

        sm.Init();

        emotionFrame = sm.AcquireFrame(true);
        em = sm.QueryEmotion();
        //print("em : " + em);
        em.QueryEmotionData(0, PXCMEmotion.Emotion.EMOTION_PRIMARY_SURPRISE, out emotion_surprise);
        em.QueryEmotionData(0, PXCMEmotion.Emotion.EMOTION_PRIMARY_SADNESS, out emotion_negative);
        em.QueryEmotionData(0, PXCMEmotion.Emotion.EMOTION_PRIMARY_JOY, out emotion_positive);
        
        BSTarget_surprise.weight = emotion_surprise.intensity * 1.25f;
        BSTarget_negative.weight = emotion_negative.intensity * 1f;
        BSTarget_positive.weight = emotion_positive.intensity * 1f;

        //if (BSTarget_surprise.weight &amp;gt; 1) BSTarget_surprise.weight = 1;
        //if (BSTarget_negative.weight &amp;gt; 1) BSTarget_negative.weight = 1;
        //if (BSTarget_positive.weight &amp;gt; 1) BSTarget_positive.weight = 1;
        
	}

    void OnOneHandDetected(EventTrigger e)
    {
        print("OnOneHandDetected called");

        print("EventSource : " + e.EventSource);
        print("TriggerAttributeName : " + e.TriggerAttributeName);
        print("Source : " + e.Source);
        print("FriendlyName : " + e.FriendlyName);


        if (e.Source == "Hand Detected")
        {
            oneHandDetected = true;
        }
        else if (e.Source == "Hand Lost")
        {
            oneHandDetected = false;
        }

    }

    void OnTwoHandsDetected(EventTrigger e)
    {
        print("OnTwoHandsDetected called " + UIPM);

        
        if(UIPM.state != InGameUIPanelManager.UIState.FAILED)
            UIPM.RestartStage();
            /*
        else if (e.Source == "Hand Lost")
        {
            twoHandsDetected = false;
        }*/

    }


    bool popupLock = false;
    void OnFaceLost(EventTrigger e)
    {
        if (popupLock == true) return;
        
        print("Come closer");
        GO_RSNotice.SetActive(true);

        popupLock = true;

    }
    void OnFaceDetected(EventTrigger e)
    {
        if (popupLock == false) return;

        print("Hide");
        GO_RSNotice.SetActive(false);

        popupLock = false;
    }
    public GameObject GO_RSNotice;

}
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2015 07:49:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Facial-Expression-done-but-optimization-issue/m-p/1019535#M37591</guid>
      <dc:creator>Jake_K_</dc:creator>
      <dc:date>2015-10-16T07:49:55Z</dc:date>
    </item>
  </channel>
</rss>

