none
Error durin running java sdk for intel real sense. RRS feed

  • Question

  • iam getting an null pointer exception at

    this line PXCMFaceConfiguration cfg=face.CreateActiveConfiguration();

    please resolve.

    /*******************************************************************************

    INTEL CORPORATION PROPRIETARY INFORMATION
    This software is supplied under the terms of a license agreement or nondisclosure
    agreement with Intel Corporation and may not be copied or disclosed except in
    accordance with the terms of that agreement
    Copyright(c) 2014 Intel Corporation. All Rights Reserved.

    *******************************************************************************/

    import intel.rssdk.*;
    import java.lang.System.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.*;

    public class FaceTracking {
        public static void main(String s[]) throws java.io.IOException
        {
            PXCMSenseManager senseMgr = PXCMSenseManager.CreateInstance();

            if (senseMgr == null)
            {
                System.out.println("Failed to create a sense manager instance.");
                return;
            }

            pxcmStatus sts = senseMgr.EnableFace(null);        
            PXCMFaceModule faceModule = senseMgr.QueryFace();

            if (sts.isError() || faceModule == null)
            {
                System.out.println("Failed to initialize face module.");
                return;
            }

            // Retrieve the input requirements
            sts = pxcmStatus.PXCM_STATUS_DATA_UNAVAILABLE;
            PXCMFaceConfiguration faceConfig = faceModule.CreateActiveConfiguration();
            faceConfig.SetTrackingMode(PXCMFaceConfiguration.TrackingModeType.FACE_MODE_COLOR_PLUS_DEPTH);        
            faceConfig.detection.isEnabled = true;        
            faceConfig.ApplyChanges();
            faceConfig.Update();

            sts = senseMgr.Init();

            if (sts.isError())
            {
                System.out.println("Init failed: " + sts);
                return;
            }

            PXCMCapture.Device dev = senseMgr.QueryCaptureManager().QueryDevice();
            PXCMCapture.DeviceInfo info = new PXCMCapture.DeviceInfo();
            dev.QueryDeviceInfo(info);
            System.out.println("Using Camera: " + info.name);

    // cfg is a PXCMFaceConfiguration instance
    // Create the SenseManager instance

    PXCMSenseManager sm=PXCMSenseManager.CreateInstance();



    // Enable face trackcing

    sm.EnableFace("lokesh");


    // Get a face instance here (or inside the AcquireFrame/ReleaseFrame loop) for configuration

    PXCMFaceModule face=sm.QueryFace();

    // Initialize the pipeline
    sm.Init();

    PXCMFaceConfiguration cfg=face.CreateActiveConfiguration();
    PXCMFaceConfiguration.RecognitionConfiguration rcfg=cfg.QueryRecognition();



    // Enable face recognition

    rcfg.Enable();



    // Create a recognition database

    PXCMFaceConfiguration.RecognitionConfiguration.RecognitionStorageDesc desc=new PXCMFaceConfiguration.RecognitionConfiguration.RecognitionStorageDesc();

    desc.maxUsers=10;

    rcfg.CreateStorage("MyDB", desc);

    rcfg.UseStorage("MyDB");



    // Set the registeration mode

    rcfg.SetRegistrationMode(PXCMFaceConfiguration.RecognitionConfiguration.RecognitionRegistrationMode.REGISTRATION_MODE_CONTINUOUS);



    // Make it effective

    cfg.ApplyChanges();


               }
    }

                                                                                                         
    Wednesday, September 5, 2018 2:24 PM

All replies

  • If you have a problem with an Intel SDK, shouldn't you post it on the Intel forums?

    This is a Microsoft forum for Kinect.

    Wednesday, September 5, 2018 2:36 PM