1 2 Previous Next 18 Replies Latest reply on Jul 6, 2018 4:55 AM by AndreiMiron

    Facial Expression sr300 camera

    AndreiMiron

      It is possible to count the facial expressions with sr300 camera and display it??

        • 1. Re: Facial Expression sr300 camera
          MartyG

          Could you explain more please about what you are trying to do with face expressions?  Thanks! 

          • 2. Re: Facial Expression sr300 camera
            AndreiMiron

            I am using the Sr300 sensor along with the R2 SDK in Unity to create an application for human ergonomics. Based on the code from the library I want to count how many times an expression was executed. The counter should count how many times this expression is detected:

            PXCMFaceData.ExpressionsData expressionData = _iFace.QueryExpressions();

                                    if (expressionData != null)

                                    {

                                        PXCMFaceData.ExpressionsData.FaceExpressionResult expressionResult;

                                        if (expressionData.QueryExpression(PXCMFaceData.ExpressionsData.FaceExpression.EXPRESSION_EYES_UP, out expressionResult))

                                            faceRenderer.DisplayExpression(expressionResult, PXCMFaceData.ExpressionsData.FaceExpression.EXPRESSION_EYES_UP); 

             

            and display the counter in

            public void DisplayExpression (PXCMFaceData.ExpressionsData.FaceExpressionResult expressionResult, PXCMFaceData.ExpressionsData.FaceExpression faceExpression)
              {
             

                ExpressionGUIText.GetComponent<TextMesh> ().text = faceExpression.ToString () + "\n" + expressionResult.intensity.ToString () ;

              }
             

            I tried to implement a counter with a static variable but my counter is counting to infinity

            • 3. Re: Facial Expression sr300 camera
              MartyG

              I thought this what what you were trying to do but wanted to check to make sure. 

               

              If you are using the SR300 and Unity for your project then you are probably doing a counter the hard way by coding it yourself.  The 2016 R2 SDK has a set of pre-made scripts called the Unity Toolkit.  This includes a mechanism called SendMessageAction for detecting a particular face expression or gesture and then triggering a specific function in a script that you have written, such as a custom-named function called CountFaceExpression() that increments the counter value by one each time it is triggered by a recognized gesture.

              • 4. Re: Facial Expression sr300 camera
                AndreiMiron

                I tried with SendMessageAction and i get several errors. Related to the hand, the QueryHand returned null appears and for the face it says that the CountFaceExpression has no receiver. I don't know what is the cause of this

                • 5. Re: Facial Expression sr300 camera
                  MartyG

                  With SendMessageAction, there are two important things to remember:

                   

                  1.  The script with your counting function in has to be in the same object as the SendMessageAction component.

                   

                  2.  In the SendMessageAction component, you put the name of the function you want to trigger, not the name of the script that function is in.  So if you have a script with a function called CountFaceExpression() then the SendMessageAction looks in every script inside the object to find one that has a function called CountFaceExpression in it.

                   

                  I should add that the function name that your counter code is in can be anything you want.  I just used CountFaceExpression as a random example I made up myself.  Whatever function name you choose, that is the one you put in the text box in the SendMessageAction.

                   

                  Also, you should not put the () brackets of the function name in the text box - just CountFaceExpression instead of CountFaceExpression().  I wrote a short illustrated guide to SendMessageAction a while ago.

                   

                  Re: [SR300] Can't reconize the gestures

                  • 6. Re: Facial Expression sr300 camera
                    AndreiMiron

                    I did configure it following your guide and still QueryHand return null i get. I can't see where the problem is

                    • 7. Re: Facial Expression sr300 camera
                      MartyG

                      Sometimes problems with using hand-related programs with the SR300 have occurred because of the processor chip in the PC being incompatible with the SR300.  This problem with compatibility occurs in the olds Windows SDKs such as '2016 R2' but not the current 'SDK 2.0'.  The official specification for the SR300 is at least a 6th generation Intel Core Skylake, or a newer processor such as 7th generation Intel Core Kaby Lake.

                       

                      Do you know what the processor in your PC is please?  You can find this information by typing 'system info' into the box at the bottom of your Windows screen to find the System Information program.  On this window, the processor information is in the 'Processor' section.  For example, my laptop says:

                       

                      Processor Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz, 2000 Mhz, 2 Core(s), 4 Logical Processor(s)

                       

                      The important part of the information is the first number after the 'i' number.  The number that is there - such as '6' in mine - gives the generation number of your processor.  Mine, being a '6', is a sixth generation Skylake.

                       

                      Processor Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz, 2000 Mhz, 2 Core(s), 4 Logical Processor(s)

                      • 8. Re: Facial Expression sr300 camera
                        AndreiMiron

                        Yes, i know that these are the specifications, and the generation of my laptop is 4 :Intel(R) Core(TM) i3-4010U CPU @ 1.70GHz, 1700 Mhz, 2 Core(s), 4 Logical Processor(s). I read some reviews that claimed that this would be the problem, but i guess if that would be, then the sensor wouldn't work at all, and it does work

                        • 9. Re: Facial Expression sr300 camera
                          MartyG

                          There was a case two weeks ago where an SR300 user with the 2016 R2 SDK was finding that most non-hand sample programs worked but the hand samples would crash when the hand was detected.  This user found that they had an incompatible processor, and the hand samples worked fine when using a 7th generation Kaby Lake PC.

                           

                          all my SR300 Samples about Hand does not work!

                          • 10. Re: Facial Expression sr300 camera
                            AndreiMiron

                            But my samples do work and i display the gestures in a GUItext but when i'm using the SendMessage action with this script to activate an image if the gesture is recognized i get that error. I used the code lines:

                            public class EneableImage : MonoBehaviour {
                                public Image Image1;
                                private void Awake()
                            {
                                 Image1 = GetComponent<UnityEngine.UI.Image>();

                            HideImage();
                                }

                            public void HideImage()
                            {
                                 Image1.enabled = false ;

                                }
                                void OnTriggerShow(){
                                    Image1.enabled = true ;
                            }

                            }

                            Untitled.jpg

                            • 11. Re: Facial Expression sr300 camera
                              MartyG

                              In my own Unity programming, if I am only using one hand in a program instead of putting both hands in front of the camera, I always tick the 'Continuous' box on the SendMessageAction.  Can you try this please?

                              • 12. Re: Facial Expression sr300 camera
                                AndreiMiron

                                Thank you for your help. I will try this tomorrow and come back with an answer. Hope this will work

                                • 13. Re: Facial Expression sr300 camera
                                  MartyG

                                  Thank you very much.  Good luck!  

                                  • 14. Re: Facial Expression sr300 camera
                                    AndreiMiron

                                    I checked the continuous tracking in the inspector and the error with QueryHand persists. But this error appears when the sensor is initialized, before i can make the gesture. If i remove the SendMessage action from the inspector, the error disappears.

                                    1 2 Previous Next