Software Archive
Read-only legacy content

Face recognition, CreateStorage() fails

Tomáš_N_
Beginner
361 Views
Hi. I'm trying to make very simple program in C# to test RealSense face recognition API. I've followed the manual but soon I discovered that there's probably a mistake in manual. In the example 74, in the "Face Recognition" section, there's PXCMFaceConfiguration.RecognitionConfiguration.RecognitionStorageDesc desc=new PXCMFaceConfiguration.RecognitionConfiguration.RecognitionStorageDesc(); desc.maxUsers=10; rcfg.CreateStorage("MyDB", desc); However, the second parameter of CreateStorage() function is defined as `out' in the API. Does it even make sense to initialize the reference before the call? Is it some kind of in-out parameter? Sorry, I'm quite unfamiliar with C#. Nevertheless, the code in the manual doesn't compile. Here's the portion of my code to initialize the face recognition (psm is PXCMSession): rc = psm.EnableFace(); if (!rc.IsSuccessful()) fail("PXCMSenseManager.EnableFace() failed", rc); var faceModule = psm.QueryFace(); var faceCfg = faceModule.CreateActiveConfiguration(); //rc = faceCfg.SetTrackingMode(PXCMFaceConfiguration.TrackingModeType.FACE_MODE_COLOR_PLUS_DEPTH); //if (!rc.IsSuccessful()) // fail("PXCMFaceConfiguration.SetTrackingMode() failed", rc); var recogCfg = faceCfg.QueryRecognition(); recogCfg.Enable(); if (!rc.IsSuccessful()) fail("PXCMFaceConfiguration.RecognitionConfiguration.Enable() failed", rc); PXCMFaceConfiguration.RecognitionConfiguration.RecognitionStorageDesc recogDesc = new PXCMFaceConfiguration.RecognitionConfiguration.RecognitionStorageDesc(); recogDesc.maxUsers = 10; rc = recogCfg.CreateStorage("UserDB", out recogDesc); if (!rc.IsSuccessful()) fail("PXCMFaceConfiguration.RecognitionConfiguration.CreateStorage() failed", rc); rc = recogCfg.UseStorage("UserDB"); if (!rc.IsSuccessful()) fail("PXCMFaceConfiguration.RecognitionConfiguration.UseStorage() failed", rc); recogCfg.SetRegistrationMode(PXCMFaceConfiguration.RecognitionConfiguration.RecognitionRegistrationMode.REGISTRATION_MODE_CONTINUOUS); rc = faceCfg.ApplyChanges(); if (!rc.IsSuccessful()) fail("PXCMFaceConfiguration.ApplyChanges() failed", rc); faceCfg.Dispose(); The code fails everytime on the CreateStorage() with PXCM_STATUS_FEATURE_UNSUPPORTED. I've F200 Camera. I'm testing it on Windows 10. RSSDK is r5_7.0.23.8048 (it happened with R4 too). Thank you for help. Sorry for not using proper formatting but Intel's forum editor is unbelievable crap.
0 Kudos
2 Replies
Bryan_B_Intel1
Employee
361 Views

Hi Tomas,

It looks like you are correct about the manual omitting the out parameter modifier, thanks for pointing that out. There is a C# facial recognition code sample available that you might want to take a look at: https://software.intel.com/en-us/articles/code-sample-facial-recognition-using-intel-realsense-sdk. 

Hope this helps, Bryan

 

0 Kudos
Tomáš_N_
Beginner
361 Views

Hello Bryan. Thanks for the quick reply.

I've tried the project you linked at it worked well. In the code, return values of CreateStore() and UseStore() functions are not checked for error though. I've checked their return values via debugger and found out that they both return PXCM_STATUS_FEATURE_UNSUPPORTED, even though the program works as excepted afterwards. So it seems that the returned status should be PXCM_STATUS_NO_ERROR.

Also, it seems that the `out' keyword cannot be used for an inout parameter, i.e. the `out' value needs to be initialized in the function. So the code in the manual (and even in the FaceID project), which initializes RecognitionStorageDesc structure/class before the call to CreateStore(), is wrong.

0 Kudos
Reply