Items with no label
3335 Discussions

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

ASimo3
Beginner
989 Views

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.

0 Kudos
1 Reply
MartyG
Honored Contributor III
124 Views

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.

https://software.intel.com/en-us/forums/realsense/topic/601499 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.

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_face_facial_expression_data.html Intel® RealSense™ SDK 2016 R2 Documentation

0 Kudos
Reply