Camera Parameter Setting in Python SDK

I am getting an error trying to change the camera parameter settings programmatically using the Python SDK. Here is the initialization code:

def initialize_nuitrack(self):

“”“Initialize Nuitrack and set up camera”“”

try:

# Check if PyNuitrack is available

if not hasattr(py_nuitrack, ‘Nuitrack’):

raise Exception(“PyNuitrack module not properly installed”)

self.nuitrack = py_nuitrack.Nuitrack()

if self.nuitrack is None:

raise Exception(“Failed to create Nuitrack instance”)

self.nuitrack.init()

# Check if initialization was successful

if self.nuitrack is None:

raise Exception(“Nuitrack initialization failed - nuitrack object is None”)

# Try to set camera to 15 fps (after initialization)

try:

self.nuitrack.set_config_value(“DepthProvider.FPS”, “15”)

print(“Camera set to 15 FPS”)

except Exception as fps_error:

print(f"Warning: Could not set camera FPS: {fps_error}")

print(“Continuing with default FPS…”)

# Try to set AI mode (only if nuitrack is properly initialized)

try:

if self.ai_mode_enabled:

self.nuitrack.set_config_value(“Skeletonization.Type”, “AI”) # Enable AI-based skeletonization

print(“AI skeletonization enabled”)

else:

print(“Using standard skeletonization”)

except Exception as config_error:

print(f"Warning: Could not set skeletonization config: {config_error}")

print(“Continuing with default settings…”)

# Get devices

devices = self.nuitrack.get_device_list()

for i, dev in enumerate(devices):

print(f"Device {i}: {dev.get_name()} - {dev.get_serial_number()}")

if i == 0:

print(f"Activation: {dev.get_activation()}")

self.nuitrack.set_device(dev)

print(f"Nuitrack version: {self.nuitrack.get_version()}")

print(f"License: {self.nuitrack.get_license()}")

self.nuitrack.create_modules()

self.nuitrack.run()

return True

except Exception as e:

print(f"Failed to initialize Nuitrack: {e}")

if “set_config_value” in str(e):

print(“This error suggests Nuitrack SDK is not properly installed or configured.”)

print(“Please ensure:”)

print(“1. Nuitrack SDK is installed”)

print(“2. Camera is properly connected”)

print(“3. You have valid Nuitrack license”)

print(“4. You’re running with appropriate permissions”)

print(“\nTry running: python test_nuitrack_install.py”)

elif “init” in str(e).lower():

print(“Nuitrack initialization failed. Check:”)

print(“1. Camera is connected and powered on”)

print(“2. Nuitrack SDK is properly installed”)

print(“3. No other applications are using the camera”)

return False

The FPS and skeletonization config do not work but the camera is found and works at the default settings. Below are the results I get:

Initializing Nuitrack…

WARNING: Can’t load module: /usr/etc/nuitrack/middleware/libKinect2DepthProvider.so

/usr/etc/nuitrack/middleware/libKinect2DepthProvider.so: cannot open shared object file: No such file or directory

WARNING: Can’t load module: /usr/etc/nuitrack/middleware/libAzureKinectDepthProvider.so

/usr/etc/nuitrack/middleware/libAzureKinectDepthProvider.so: cannot open shared object file: No such file or directory

Warning: Could not set camera FPS: Python argument types in

None.set_config_value(Nuitrack, str, str)

did not match C++ signature:

set_config_value(PyNuitrack {lvalue}, std::string, std::string)

Continuing with default FPS…

Warning: Could not set skeletonization config: Python argument types in

None.set_config_value(Nuitrack, str, str)

did not match C++ signature:

set_config_value(PyNuitrack {lvalue}, std::string, std::string)

Continuing with default settings…

Device 0: Astra Mini Pro - AD7Z843002X

Activation: Trial

Nuitrack version: 3805

I also saw that you can change the parameters using a json setup file which I found but I couldn’t find the documentation on the syntax.

Hello @danh
To set the FPS and resolution, you can

  • add the following values to the %NUITRACK_HOME%/data/nuitrack.config file

     "OrbbecSDKDepthProviderModule": {	
      "Depth": {
     		//"Resolution": [640, 480],
     		"FPS": 15,
     		"AutoExposure": true
     	},
      "RGB": {
     		//"Resolution": [640, 480],
     		"FPS": 15,
     		"AutoExposure": true
     	},
       }
    
  • or use set_config_value

    nuitrack.set_config_value("OrbbecSDKDepthProviderModule.Depth.FPS", "15")
    nuitrack.set_config_value("OrbbecSDKDepthProviderModule.RGB.FPS", "15")
    

Thanks. I was able to get the FPS set using the config file. I did have to uncomment the resolution otherwise it gave the following error:

ERROR: Can’t create DepthSensor module
nuicore.hpp: 176 - OrbbecSDKDepthProviderModule.Depth.Resolution option was not set

Failed to initialize Nuitrack: NuitrackException (ModuleNotInitializedException): Can’t create DepthSensor module
nuicore.hpp: 176 - OrbbecSDKDepthProviderModule.Depth.Resolution option was not set

When I try to use set_config_value, I still get the same error using the new naming you provided.

example for set_config_value

nuitrack.set_config_value("OrbbecSDKDepthProviderModule.Depth.FPS", "15")
nuitrack.set_config_value("OrbbecSDKDepthProviderModule.Depth.Resolution.Width", "320")
nuitrack.set_config_value("OrbbecSDKDepthProviderModule.Depth.Resolution.Height", "200")
nuitrack.set_config_value("OrbbecSDKDepthProviderModule.RGB.FPS", "15")
nuitrack.set_config_value("OrbbecSDKDepthProviderModule.RGB.Resolution.Width", "640")
nuitrack.set_config_value("OrbbecSDKDepthProviderModule.RGB.Resolution.Height", "400")