1 Reply Latest reply on Oct 22, 2017 8:55 AM by MartyG

    QueryExpressions() returns null. SR300, SDK2016 R2, Java.

    ArtyomSimonovich

      Hi all. I work on emotion recognition problem via this API. I made some configuration in this code:

       

      PXCMSenseManager senseMgr = PXCMSenseManager.CreateInstance();

       

      senseMgr.EnableFace(null);

       

      PXCMFaceModule faceModule = senseMgr.QueryFace();

       

      PXCMFaceConfiguration faceConfig = faceModule.CreateActiveConfiguration();

      faceConfig.SetTrackingMode(

                  PXCMFaceConfiguration.TrackingModeType.FACE_MODE_COLOR_PLUS_DEPTH);

       

      PXCMFaceConfiguration.ExpressionsConfiguration expc = faceConfig.QueryExpressions();

      expc.Enable();

      expc.EnableAllExpressions();

       

      faceConfig.strategy =

               PXCMFaceConfiguration.TrackingStrategyType.STRATEGY_CLOSEST_TO_FARTHEST;

      faceConfig.detection.maxTrackedFaces = 1;

      faceConfig.landmarks.maxTrackedFaces = 1;

      faceConfig.pose.maxTrackedFaces = 1;

      faceConfig.EnableAllAlerts();

       

      faceConfig.ApplyChanges();

       

      sts = senseMgr.Init();

       

      then I turned on the device, it recognized faces for me, I successfully identified pose, printed landmarks (so, I guess it configurated right). But when I try to recognize emotion, QueryExpressions() always returns null in this part of code:

       

      PXCMFaceData.ExpressionsData recData =

                                                  face.QueryExpressions();

                                          if (recData != null) {

                                              PXCMFaceData.ExpressionsData.FaceExpressionResult score =

                                                      new PXCMFaceData.ExpressionsData.FaceExpressionResult();

                                              recData.QueryExpression(

                                                      PXCMFaceData.ExpressionsData.FaceExpression.EXPRESSION_BROW_LOWERER_LEFT,

                                                      score);

                                              System.out.println(score.intensity);

                                          }

       

      What am I doing wrong? Help me, please.

        • 1. Re: QueryExpressions() returns null. SR300, SDK2016 R2, Java.
          MartyG

          You are using the correct SDK, as '2016 R2' is the most stable SDK available for face recognition tasks.

           

          It is not recommended by Intel to use Java, as the web component of the R2 RealSense SDK and the SDKs before it has a potential security vulnerability in it.  I believe that the web component will still work in R2 despite this warning by Intel - you should just be aware of the potential security issue if you continue to use Java in the RealSense SDK.

           

          Someone else once had the problem with getting null from QueryExpressions() in Java when using FaceExpressions.  Unfortunately a solution was not offered in that case.

           

          FaceExpressions in Java

           

          I managed to dig up a page in the official RealSense docs for expression detection that has a Java script to compare your own code to.

           

          Intel® RealSense™ SDK 2016 R2 Documentation