OrbbecSDK V2 Python Wrapper
  • 1. Overview
    • 1.1. Introduction
      • 1.1.1. Device Support Comparison
      • 1.1.2. Supported Platforms
      • 1.1.3. Support Hardware Products
        • 1.1.3.1. v2-main Branch
        • 1.1.3.2. main Branch (v1.x)
      • 1.1.4. Support Platforms
    • 1.2. Orbbec SDK Overview
      • 1.2.1. Terms
      • 1.2.2. Orbbec SDK v2 Architecture Overview
      • 1.2.3. SDK Concept Overview
      • 1.2.4. SDK Programming Model
  • 2. Installation
    • 2.1. Virtual Environment Installation Guide
      • 2.1.1. 📋 Table of Contents
      • 2.1.2. 📊 Tool Selection Guide
      • 2.1.3. Quick Start
        • 2.1.3.1. Linux / macOS (venv)
        • 2.1.3.2. Windows (venv)
      • 2.1.4. 1. Using venv (Recommended for Beginners)
        • 2.1.4.1. 1.1 Check Python Version
        • 2.1.4.2. 1.2 Create Virtual Environment
        • 2.1.4.3. 1.3 Activate Virtual Environment
        • 2.1.4.4. 1.4 Install pyorbbecsdk2
        • 2.1.4.5. 1.5 Verify Installation
        • 2.1.4.6. 1.6 Run Examples
        • 2.1.4.7. 1.7 Deactivate Virtual Environment
      • 2.1.5. 2. Using pyenv (Multiple Python Versions)
        • 2.1.5.1. 2.1 Install pyenv
        • 2.1.5.2. 2.2 Install Python 3.10
        • 2.1.5.3. 2.3 Set Local Python Version in Project Directory
        • 2.1.5.4. 2.4 Create Virtual Environment and Activate
        • 2.1.5.5. 2.5 Install pyorbbecsdk2
        • 2.1.5.6. 2.6 Complete Workflow Example
      • 2.1.6. 3. Using conda (Data Science Users)
        • 2.1.6.1. 3.1 Install Miniconda
        • 2.1.6.2. 3.2 Create conda Environment
        • 2.1.6.3. 3.3 Install Dependencies (Optional)
        • 2.1.6.4. 3.4 Install pyorbbecsdk2
        • 2.1.6.5. 3.5 Exit Environment
        • 2.1.6.6. 3.6 Remove Environment (if needed)
      • 2.1.7. Platform-Specific Notes
        • 2.1.7.1. Linux
          • 2.1.7.1.1. Ubuntu/Debian
        • 2.1.7.2. macOS
          • 2.1.7.2.1. Xcode Command Line Tools
          • 2.1.7.2.2. Permission Issues
        • 2.1.7.3. Windows
          • 2.1.7.3.1. Visual C++ Redistributable
          • 2.1.7.3.2. PowerShell Execution Policy
      • 2.1.8. Troubleshooting
        • 2.1.8.1. ❌ “externally-managed-environment” Error
        • 2.1.8.2. ❌ “No module named ‘venv’”
        • 2.1.8.3. ❌ Virtual Environment Activated but Still Using System Python
        • 2.1.8.4. ❌ pip install Shows Permission Denied
        • 2.1.8.5. ❌ “pyorbbec_env/bin/activate: No such file”
      • 2.1.9. 📝 Best Practices
      • 2.1.10. 🔗 Related Documentation
    • 2.2. Environment Setup (One-Time Configuration)
      • 2.2.1. Quick Setup (Recommended)
        • 2.2.1.1. From Repository
          • 2.2.1.1.1. Windows (PowerShell)
          • 2.2.1.1.2. Linux
          • 2.2.1.1.3. macOS
        • 2.2.1.2. From Installed Package
        • 2.2.1.3. Command Options
      • 2.2.2. What This Setup Does
        • 2.2.2.1. Windows
        • 2.2.2.2. Linux
        • 2.2.2.3. macOS
      • 2.2.3. Manual Configuration (Advanced)
        • 2.2.3.1. Linux - Manual udev Rules Installation
        • 2.2.3.2. Windows - Manual Metadata Registration
    • 2.3. Installation Guide
      • 2.3.1. 📋 System Requirements
        • 2.3.1.1. Hardware Requirements
      • 2.3.2. 📖 Detailed Installation
        • 2.3.2.1. Prerequisites
        • 2.3.2.2. Python Version Check
        • 2.3.2.3. Virtual Environment (Recommended)
        • 2.3.2.4. Environment Setup (One-Time)
        • 2.3.2.5. System-Specific Prerequisites
        • 2.3.2.6. Installation Methods
        • 2.3.2.7. Method 1: pip install (Recommended)
        • 2.3.2.8. Method 2: Offline Wheel Installation
          • 2.3.2.8.1. Step 1: Download the Wheel
          • 2.3.2.8.2. Step 2: Install the Wheel
        • 2.3.2.9. “Hello World” Example
        • 2.3.2.10. Run an Example
      • 2.3.3. 🚀 Quick Install (TL;DR)
      • 2.3.4. 🐛 Troubleshooting
        • 2.3.4.1. “No device found” (Linux)
        • 2.3.4.2. Permission denied (macOS)
        • 2.3.4.3. ImportError on Windows
        • 2.3.4.4. Metadata/Timestamp Issues (Windows)
        • 2.3.4.5. Python Version Mismatch
        • 2.3.4.6. Offline Installation Fails
        • 2.3.4.7. Examples Not Running
      • 2.3.5. 📚 Next Steps
        • 2.3.5.1. Common Example Commands
      • 2.3.6. 📖 Additional Resources
  • 3. QuickStarts
    • 3.1. QuickStart Guide
    • 3.2. 🎯 Overview
      • 3.2.1. What You’ll Learn
      • 3.2.2. Time to Complete
      • 3.2.3. Final Result
    • 3.3. ✅ Prerequisites
      • 3.3.1. Hardware
      • 3.3.2. Software
      • 3.3.3. Quick Verification
      • 3.3.4. Platform-Specific Notes
    • 3.4. 🚀 Your First Application
      • 3.4.1. Step 1: Run the Quick Start Example
      • 3.4.2. Step 2: How It Works
      • 3.4.3. Step 3: Common Customizations
        • 3.4.3.1. Custom Resolution/FPS
        • 3.4.3.2. Color-Only Mode
        • 3.4.3.3. Save Frames to Disk
    • 3.5. 🐛 Troubleshooting
      • 3.5.1. “No device found” (Linux)
      • 3.5.2. Permission denied (macOS)
      • 3.5.3. Import Error
      • 3.5.4. Empty Frames
      • 3.5.5. Display Issues
      • 3.5.6. Metadata/Timestamp Issues (Windows)
    • 3.6. 📚 Next Steps
      • 3.6.1. 🗺️ Recommended Learning Path
      • 3.6.2. 🎓 Learn by Example
      • 3.6.3. Level 1 — Beginner ⭐
      • 3.6.4. Level 2 — Advanced ⭐⭐
      • 3.6.5. Level 3 — Applications ⭐⭐⭐
      • 3.6.6. Specialized — LiDAR ⭐⭐⭐
      • 3.6.7. 🔗 Additional Resources
      • 3.6.8. 📝 SDK Feature Overview
    • 3.7. 💡 Tips for Success
  • 4. Package
    • 4.1. Build from Source with UV (Recommended)
      • 4.1.1. Prerequisites
        • 4.1.1.1. All Platforms
        • 4.1.1.2. Platform-Specific Requirements
          • 4.1.1.2.1. Linux
          • 4.1.1.2.2. macOS
          • 4.1.1.2.3. Windows
      • 4.1.2. Build Scripts
      • 4.1.3. Quick Start
        • 4.1.3.1. Linux
        • 4.1.3.2. macOS
        • 4.1.3.3. Windows
      • 4.1.4. Script Options
        • 4.1.4.1. Examples
      • 4.1.5. Offline Build
        • 4.1.5.1. Preparing for Offline Build
        • 4.1.5.2. How Offline Mode Works
      • 4.1.6. Build Output
        • 4.1.6.1. Installing the Wheel
        • 4.1.6.2. Generate Type Stubs (Optional but Recommended)
      • 4.1.7. Build Process Details
        • 4.1.7.1. Key Differences by Platform
      • 4.1.8. Troubleshooting
        • 4.1.8.1. Common Issues
          • 4.1.8.1.1. “uv: command not found”
          • 4.1.8.1.2. “CMake configuration failed”
          • 4.1.8.1.3. “pybind11 not found” (Offline mode)
          • 4.1.8.1.4. “Permission denied” on macOS
          • 4.1.8.1.5. Build fails on Windows with “Visual Studio not found”
        • 4.1.8.2. Cleaning Build Artifacts
      • 4.1.9. Advanced Usage
        • 4.1.9.1. Customizing Python Versions
        • 4.1.9.2. Parallel Builds
        • 4.1.9.3. Environment Variables
      • 4.1.10. Comparison with Traditional Build
      • 4.1.11. Next Steps
      • 4.1.12. See Also
    • 4.2. Build from Source (Traditional CMake Method - Deprecated)
      • 4.2.1. Environment
        • 4.2.1.1. Compilation Platform Requirements
        • 4.2.1.2. Python Version
      • 4.2.2. Linux Python SDK Compilation
        • 4.2.2.1. Install Dependencies (Ubuntu)
        • 4.2.2.2. Custom Python Path (Optional)
        • 4.2.2.3. Build the Project
        • 4.2.2.4. Run the Examples
        • 4.2.2.5. Generate Python Stubs
        • 4.2.2.6. Making a Python Wheel
      • 4.2.3. Windows Python SDK Compilation
        • 4.2.3.1. Download the Python SDK Source Code
        • 4.2.3.2. Install Dependencies
        • 4.2.3.3. Configure Visual Studio Project
        • 4.2.3.4. Compile the Python SDK
        • 4.2.3.5. Test Examples
  • 5. Application Guide
    • 5.1. Create Device
    • 5.2. Create Pipeline
    • 5.3. Obtain the Sensor List
    • 5.4. Obtain Video Data Streams
      • 5.4.1. Blocking Polling Mode (Video Data Streams)
      • 5.4.2. Asynchronous Callback Mode (Video Data Streams)
    • 5.5. Obtain Imu Data Streams
      • 5.5.1. Blocking Polling Mode (Imu Data Streams)
      • 5.5.2. Asynchronous Callback Mode (Imu Data Streams)
    • 5.6. Obtain the Camera Intrinsic and Extrinsic Parameters
    • 5.7. Frame Aggregate
    • 5.8. D2C
      • 5.8.1. Hardware D2C
      • 5.8.2. Software D2C
    • 5.9. Software C2D
    • 5.10. Depth Point Cloud
    • 5.11. RGBD Point Cloud
    • 5.12. Noise Removeal Filter
      • 5.12.1. Hardware Noise Removeal Filter
      • 5.12.2. Software Noise Removeal Filter
    • 5.13. Depth Post-Processing Filters
    • 5.14. Recording and Playback
      • 5.14.1. Recording
      • 5.14.2. Playback
    • 5.15. Firmware Update
    • 5.16. Update Preset
    • 5.17. Device Disconnection and Reconnection
    • 5.18. Commonly Used Interfaces
      • 5.18.1. Device Reboot
      • 5.18.2. Obtain the Serial Number
      • 5.18.3. Obtain the IP Config
      • 5.18.4. Obtain Local Network Configuration
      • 5.18.5. IP Configuration
        • 5.18.5.1. Set IP Configuration (Persistent)
        • 5.18.5.2. Force IP Configuration (Temporary)
      • 5.18.6. Obtain Device Temperature
      • 5.18.7. Obtain Device Baseline
      • 5.18.8. Stream Profile
      • 5.18.9. Obtain IMU StreamProfile
      • 5.18.10. Obtain Intrinsic and Extrinsic Parameters
      • 5.18.11. Obtain IMU Intrinsic Parameters
      • 5.18.12. LDP Switch
      • 5.18.13. HDR Merge
      • 5.18.14. Obtain LDP Measurement Value
      • 5.18.15. Obtain LDP Protection Status
      • 5.18.16. Laser Switch
      • 5.18.17. Obtain MetaData
      • 5.18.18. Triggered Capture
        • 5.18.18.1. Software Triggered Capture
        • 5.18.18.2. Timed Capture
      • 5.18.19. Timestamp Reset
      • 5.18.20. Device Time Synchronization
      • 5.18.21. D2D (Disparity to depth)
        • 5.18.21.1. Hardware D2D
        • 5.18.21.2. Software D2D
      • 5.18.22. Depth Settings
        • 5.18.22.1. Depth Working Mode
        • 5.18.22.2. Preset Configuration
        • 5.18.22.3. Set Depth AE
        • 5.18.22.4. Set Depth Exposure
        • 5.18.22.5. Set Depth Gain
        • 5.18.22.6. Set Depth Mirror
        • 5.18.22.7. Set Depth Flip
        • 5.18.22.8. Set Depth Rotation
        • 5.18.22.9. Set the Unit of Depth
        • 5.18.22.10. Set Min and Max Depth
      • 5.18.23. IR Parameter Settings
        • 5.18.23.1. Set IR AE
        • 5.18.23.2. Set IR Exposure
        • 5.18.23.3. Set IR Gain
        • 5.18.23.4. Set IR Target Brightness
        • 5.18.23.5. Set IR Maximum Exposure Value
        • 5.18.23.6. set IR Mirror
        • 5.18.23.7. Set IR Flip
        • 5.18.23.8. Set IR Rotation
      • 5.18.24. Color Parameter Settings
        • 5.18.24.1. Set Color AE
        • 5.18.24.2. Set Color Exposure
        • 5.18.24.3. Set Color Gain
        • 5.18.24.4. set Color Mirror
        • 5.18.24.5. Set Color Flip
        • 5.18.24.6. Set Color Rotation
        • 5.18.24.7. Set Color Automatic White Balance (AWB)
        • 5.18.24.8. Set Color White Balance Parameters
        • 5.18.24.9. Set the Color Brightness
        • 5.18.24.10. Set Color Sharpness
        • 5.18.24.11. Set Color Gamma
        • 5.18.24.12. Set Color Saturation
        • 5.18.24.13. Set Color Hue
        • 5.18.24.14. Set Color Auto Exposure Priority
        • 5.18.24.15. Set Color Backlight Compensation
        • 5.18.24.16. Set Color Contrast
        • 5.18.24.17. Set Color Power Line Frequency
      • 5.18.25. Multi-Camera Synchronization
        • 5.18.25.1. Multi-Camera Synchronous Hardware Connection
        • 5.18.25.2. Multi-Camera Synchronization Software Configuration
      • 5.18.26. Frame Interleave
        • 5.18.26.1. Load Frame Interleave
        • 5.18.26.2. Check Frame Interleave Support
      • 5.18.27. Heart Beat Control
      • 5.18.28. Log Management
        • 5.18.28.1. Set the log level
        • 5.18.28.2. Set the Log Output to the Console
        • 5.18.28.3. Set Log Output to File
        • 5.18.28.4. Set the Log Callback Output
  • 6. API Reference
    • 6.1. Core
      • 6.1.1. Classes
        • 6.1.1.1. Context
          • Context
        • 6.1.1.2. Device
          • Device
        • 6.1.1.3. DeviceInfo
          • DeviceInfo
        • 6.1.1.4. DeviceList
          • DeviceList
        • 6.1.1.5. DevicePresetList
          • DevicePresetList
        • 6.1.1.6. Sensor
          • Sensor
        • 6.1.1.7. SensorList
          • SensorList
        • 6.1.1.8. CameraParamList
          • CameraParamList
        • 6.1.1.9. PresetResolutionConfigList
          • PresetResolutionConfigList
        • 6.1.1.10. OBDepthWorkModeList
          • OBDepthWorkModeList
    • 6.2. Pipeline
      • 6.2.1. Classes
        • 6.2.1.1. Pipeline
          • Pipeline
        • 6.2.1.2. Config
          • Config
    • 6.3. Frames
      • 6.3.1. Class Hierarchy
      • 6.3.2. Inheritance Overview
      • 6.3.3. Classes
        • 6.3.3.1. Frame
          • Frame
        • 6.3.3.2. VideoFrame
          • VideoFrame
        • 6.3.3.3. ColorFrame
          • ColorFrame
        • 6.3.3.4. DepthFrame
          • DepthFrame
        • 6.3.3.5. IRFrame
          • IRFrame
        • 6.3.3.6. ConfidenceFrame
          • ConfidenceFrame
        • 6.3.3.7. PointsFrame
          • PointsFrame
        • 6.3.3.8. LiDARPointsFrame
          • LiDARPointsFrame
        • 6.3.3.9. AccelFrame
          • AccelFrame
        • 6.3.3.10. GyroFrame
          • GyroFrame
        • 6.3.3.11. FrameSet
          • FrameSet
      • 6.3.4. Enumerations
        • 6.3.4.1. OBFrameType
          • pyorbbecsdk.OBFrameType
        • 6.3.4.2. OBFrameMetadataType
          • pyorbbecsdk.OBFrameMetadataType
        • 6.3.4.3. OBFormat
          • pyorbbecsdk.OBFormat
        • 6.3.4.4. OBMediaType
          • pyorbbecsdk.OBMediaType
        • 6.3.4.5. OBMediaState
          • pyorbbecsdk.OBMediaState
        • 6.3.4.6. OBPlaybackStatus
          • pyorbbecsdk.OBPlaybackStatus
      • 6.3.5. Constants
        • UNKNOWN
        • PAUSED
        • PLAYING
        • STOPPED
        • COUNT
    • 6.4. Stream Profile
      • 6.4.1. Class Hierarchy
      • 6.4.2. Inheritance Overview
      • 6.4.3. Classes
        • 6.4.3.1. StreamProfile
          • StreamProfile
        • 6.4.3.2. VideoStreamProfile
          • VideoStreamProfile
        • 6.4.3.3. AccelStreamProfile
          • AccelStreamProfile
        • 6.4.3.4. GyroStreamProfile
          • GyroStreamProfile
        • 6.4.3.5. LiDARStreamProfile
          • LiDARStreamProfile
        • 6.4.3.6. StreamProfileList
          • StreamProfileList
      • 6.4.4. Enumerations
        • 6.4.4.1. OBSensorType
          • pyorbbecsdk.OBSensorType
        • 6.4.4.2. OBStreamType
          • pyorbbecsdk.OBStreamType
        • 6.4.4.3. OBDepthWorkMode
        • 6.4.4.4. OBDepthWorkModeList
        • 6.4.4.5. OBDepthWorkModeTag
        • 6.4.4.6. OBPresetResolutionConfig
        • 6.4.4.7. OBAlignMode
          • pyorbbecsdk.OBAlignMode
        • 6.4.4.8. OBFrameAggregateOutputMode
          • pyorbbecsdk.OBFrameAggregateOutputMode
        • 6.4.4.9. OBCompressionMode
          • pyorbbecsdk.OBCompressionMode
        • 6.4.4.10. OBCompressionParams
        • 6.4.4.11. OBHardwareDecimationConfig
        • 6.4.4.12. OBHdrConfig
        • 6.4.4.13. OBSyncMode
          • pyorbbecsdk.OBSyncMode
        • 6.4.4.14. OBMultiDeviceSyncMode
          • pyorbbecsdk.OBMultiDeviceSyncMode
        • 6.4.4.15. OBGyroSampleRate
          • pyorbbecsdk.OBGyroSampleRate
      • 6.4.5. Constants
        • SAMPLE_RATE_UNKNOWN
        • SAMPLE_RATE_1_5625_HZ
        • SAMPLE_RATE_3_125_HZ
        • SAMPLE_RATE_6_25_HZ
        • SAMPLE_RATE_12_5_HZ
        • SAMPLE_RATE_25_HZ
        • SAMPLE_RATE_50_HZ
        • SAMPLE_RATE_100_HZ
        • SAMPLE_RATE_200_HZ
        • SAMPLE_RATE_400_HZ
        • SAMPLE_RATE_500_HZ
        • SAMPLE_RATE_1_KHZ
        • SAMPLE_RATE_2_KHZ
        • SAMPLE_RATE_4_KHZ
        • SAMPLE_RATE_8_KHZ
        • SAMPLE_RATE_16_KHZ
        • SAMPLE_RATE_32_KHZ
        • SAMPLE_RATE_800_HZ
    • 6.5. Filters
      • 6.5.1. Class Hierarchy
      • 6.5.2. Inheritance Overview
      • 6.5.3. Classes
        • 6.5.3.1. Filter
          • Filter
        • 6.5.3.2. AlignFilter
          • AlignFilter
        • 6.5.3.3. DecimationFilter
          • DecimationFilter
        • 6.5.3.4. DisparityTransform
          • DisparityTransform
        • 6.5.3.5. FormatConvertFilter
          • FormatConvertFilter
        • 6.5.3.6. HDRMergeFilter
          • HDRMergeFilter
        • 6.5.3.7. HoleFillingFilter
          • HoleFillingFilter
        • 6.5.3.8. NoiseRemovalFilter
          • NoiseRemovalFilter
        • 6.5.3.9. PointCloudFilter
          • PointCloudFilter
        • 6.5.3.10. SequenceIdFilter
          • SequenceIdFilter
        • 6.5.3.11. SpatialAdvancedFilter
          • SpatialAdvancedFilter
        • 6.5.3.12. TemporalFilter
          • TemporalFilter
        • 6.5.3.13. ThresholdFilter
          • ThresholdFilter
      • 6.5.4. Enumerations
        • 6.5.4.1. OBFilterList
        • 6.5.4.2. OBFilterConfigSchemaItem
        • 6.5.4.3. OBFilterConfigValueType
          • pyorbbecsdk.OBFilterConfigValueType
        • 6.5.4.4. OBHoleFillingMode
          • pyorbbecsdk.OBHoleFillingMode
        • 6.5.4.5. OBNoiseRemovalFilterParams
        • 6.5.4.6. OBEdgeNoiseRemovalType
          • pyorbbecsdk.OBEdgeNoiseRemovalType
        • 6.5.4.7. OBEdgeNoiseRemovalFilterParams
        • 6.5.4.8. OBDDONoiseRemovalType
          • pyorbbecsdk.OBDDONoiseRemovalType
        • 6.5.4.9. OBSpatialAdvancedFilterParams
        • 6.5.4.10. OBConvertFormat
          • pyorbbecsdk.OBConvertFormat
    • 6.6. Record & Playback
      • 6.6.1. Classes
        • 6.6.1.1. RecordDevice
          • RecordDevice
        • 6.6.1.2. PlaybackDevice
          • PlaybackDevice
    • 6.7. Data Structures
      • 6.7.1. Enumerations
        • 6.7.1.1. OBLogLevel
          • pyorbbecsdk.OBLogLevel
        • 6.7.1.2. OBError
        • 6.7.1.3. OBException
          • pyorbbecsdk.OBException
        • 6.7.1.4. OBStatus
          • pyorbbecsdk.OBStatus
        • 6.7.1.5. OBCameraParam
        • 6.7.1.6. OBCameraIntrinsic
        • 6.7.1.7. OBCameraDistortion
        • 6.7.1.8. OBCameraDistortionModel
          • pyorbbecsdk.OBCameraDistortionModel
        • 6.7.1.9. OBExtrinsic
        • 6.7.1.10. OBBaselineCalibrationParam
        • 6.7.1.11. OBCalibrationParam
        • 6.7.1.12. OBAccelIntrinsic
        • 6.7.1.13. OBGyroIntrinsic
        • 6.7.1.14. OBAccelFullScaleRange
          • pyorbbecsdk.OBAccelFullScaleRange
        • 6.7.1.15. OBGyroFullScaleRange
          • pyorbbecsdk.OBGyroFullScaleRange
        • 6.7.1.16. OBAccelValue
        • 6.7.1.17. OBGyroValue
        • 6.7.1.18. OBFloat3D
        • 6.7.1.19. OBPoint2f
        • 6.7.1.20. OBPoint3f
        • 6.7.1.21. OBRect
        • 6.7.1.22. OBRegionOfInterest
        • 6.7.1.23. OBLiDARPoint
        • 6.7.1.24. OBLiDARScanPoint
        • 6.7.1.25. OBLiDARSpherePoint
        • 6.7.1.26. OBLiDARScanRate
          • pyorbbecsdk.OBLiDARScanRate
        • 6.7.1.27. OBColorPoint
        • 6.7.1.28. OBPixelType
          • pyorbbecsdk.OBPixelType
        • 6.7.1.29. OBPowerLineFreqMode
          • pyorbbecsdk.OBPowerLineFreqMode
        • 6.7.1.30. OBDCPowerState
          • pyorbbecsdk.OBDCPowerState
        • 6.7.1.31. OBUSBPowerState
          • pyorbbecsdk.OBUSBPowerState
        • 6.7.1.32. OBCommunicationType
          • pyorbbecsdk.OBCommunicationType
        • 6.7.1.33. OBProtocolVersion
        • 6.7.1.34. OBCmdVersion
          • pyorbbecsdk.OBCmdVersion
        • 6.7.1.35. OBCoordinateSystemType
          • pyorbbecsdk.OBCoordinateSystemType
        • 6.7.1.36. OBRotateDegreeType
          • pyorbbecsdk.OBRotateDegreeType
        • 6.7.1.37. OBDepthPrecisionLevel
          • pyorbbecsdk.OBDepthPrecisionLevel
        • 6.7.1.38. OBDepthCroppingMode
          • pyorbbecsdk.OBDepthCroppingMode
        • 6.7.1.39. OBTofFilterRange
          • pyorbbecsdk.OBTofFilterRange
        • 6.7.1.40. OBTofExposureThresholdControl
        • 6.7.1.41. OBSequenceIdItem
        • 6.7.1.42. OBUpgradeState
          • pyorbbecsdk.OBUpgradeState
        • 6.7.1.43. OBDataTranState
          • pyorbbecsdk.OBDataTranState
        • 6.7.1.44. OBFileTranState
          • pyorbbecsdk.OBFileTranState
    • 6.8. Utilities
      • 6.8.1. Functions
        • 6.8.1.1. get_version
          • get_version()
        • 6.8.1.2. save_point_cloud_to_ply
          • save_point_cloud_to_ply()
        • 6.8.1.3. save_lidar_point_cloud_to_ply
          • save_lidar_point_cloud_to_ply()
        • 6.8.1.4. transformation2dto2d
          • transformation2dto2d()
        • 6.8.1.5. transformation2dto3d
          • transformation2dto3d()
        • 6.8.1.6. transformation3dto2d
          • transformation3dto2d()
        • 6.8.1.7. transformation3dto3d
          • transformation3dto3d()
    • 6.9. Quick Links
    • 6.10. Module Overview
  • 7. FAQ
    • 7.1. Table of Contents
    • 7.2. Installation Issues
      • 7.2.1. No device found on Linux
      • 7.2.2. Permission denied on macOS
      • 7.2.3. ImportError on Windows
      • 7.2.4. Python version mismatch
      • 7.2.5. Offline installation fails
      • 7.2.6. Package name confusion
      • 7.2.7. Open3D and NumPy version compatibility
    • 7.3. Build Issues
      • 7.3.1. uv command not found
      • 7.3.2. CMake configuration failed
      • 7.3.3. pybind11 not found in offline mode
      • 7.3.4. Build fails on Windows with Visual Studio not found
    • 7.4. Runtime Issues
      • 7.4.1. Empty frames or frames is None
      • 7.4.2. Display issues with OpenCV
      • 7.4.3. Jetson Nano illegal instruction
      • 7.4.4. Import Error ModuleNotFoundError
    • 7.5. Platform-Specific Issues
      • 7.5.1. USB device access permission error on Linux
      • 7.5.2. Metadata or timestamp issues on Windows
      • 7.5.3. macOS camera and terminal authorization
    • 7.6. Camera and Streaming
      • 7.6.1. Frame synchronization failures
      • 7.6.2. Resolution or FPS configuration issues
    • 7.7. Configuration
      • 7.7.1. How to configure or disable SDK logging
    • 7.8. Firmware
      • 7.8.1. Firmware version mismatch
      • 7.8.2. How to update firmware
    • 7.9. Additional Resources
  • 8. License
OrbbecSDK V2 Python Wrapper
  • 4. Package
  • 4.1. Build from Source with UV (Recommended)
  • View page source

4.1. Build from Source with UV (Recommended)

This guide explains how to build pyorbbecsdk wheel packages using uv, a fast Python package manager and resolver. The UV-based build system provides significant advantages over traditional pip/venv workflows:

  • Fast dependency resolution: UV resolves dependencies 10-100x faster than pip

  • Automatic Python version management: UV can install and manage multiple Python versions

  • Automatic virtual environments: UV creates and manages isolated environments automatically

  • Offline support: Build without internet access using cached dependencies

  • Cross-platform: Unified build process across Linux, macOS, and Windows

  • Reproducible builds: Consistent environment setup across different machines

💡 Prefer traditional virtual environments?

If you prefer using standard venv, pyenv, or conda instead of UV, see the Virtual Environment Installation Guide for alternative setup instructions.

4.1.1. Prerequisites

4.1.1.1. All Platforms

  1. Install uv: Follow the official uv installation guide

    # Linux/macOS
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Windows PowerShell
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  2. Verify uv installation:

    uv --version
    
  3. Install CMake (3.15.0 or higher):

    • Download from CMake official website

    • Or install via package manager

  4. Verify Build Environment:

    Before building, verify that the required compiler tools are installed:

    === “Linux/macOS”

    ```bash
    # Check CMake version (requires 3.15.0+)
    cmake --version
    
    # Check GCC version (requires 7.4.0+)
    gcc --version
    g++ --version
    ```
    

    === “Windows”

    ```powershell
    # Check CMake version
    cmake --version
    
    # Check Visual Studio installation
    # Option 1: Using vswhere (if installed with VS)
    & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
    
    # Option 2: Check for cl.exe
    Get-Command cl.exe -ErrorAction SilentlyContinue
    ```
    

    CMake and Visual Studio Version Compatibility (Windows):

Visual Studio Version Minimum CMake Version
Visual Studio 2019 3.15.0+
Visual Studio 2022 3.20.0+
Visual Studio 2026 4.2.0+

If any command fails, refer to the Platform-Specific Requirements section below.

  1. Clone the repository:

    git clone https://github.com/orbbec/pyorbbecsdk.git
    cd pyorbbecsdk
    git checkout v2-main
    

4.1.1.2. Platform-Specific Requirements

4.1.1.2.1. Linux

  • GCC 7.4.0 or higher

  • Python development headers

# Ubuntu/Debian
sudo apt-get update
sudo apt-get install python3-dev build-essential

# CentOS/RHEL/Fedora
sudo yum install python3-devel gcc-c++

4.1.1.2.2. macOS

  • Xcode Command Line Tools

  • Clang/Clang++ compiler

# Install Xcode Command Line Tools
xcode-select --install

4.1.1.2.3. Windows

  • Visual Studio 2019 or 2022 with C++ build tools

  • Windows SDK

4.1.2. Build Scripts

The project provides platform-specific UV build scripts:

Platform Script
Linux scripts/build_whl/build-whl-uv.sh
macOS scripts/build_whl/build-whl-uv-macos.sh
Windows scripts/build_whl/build-whl-uv.ps1

Note: These scripts are available in the feature/uv_cli branch. To use them, switch to that branch or copy the scripts to your working directory.

4.1.3. Quick Start

4.1.3.1. Linux

# Make the script executable
chmod +x scripts/build_whl/build-whl-uv.sh

# Build for Python 3.10 (default)
./scripts/build_whl/build-whl-uv.sh

# Build for specific Python version
./scripts/build_whl/build-whl-uv.sh 3.11

# Build for multiple Python versions
./scripts/build_whl/build-whl-uv.sh 3.9 3.10 3.11

# Build all supported versions (3.8-3.13)
./scripts/build_whl/build-whl-uv.sh all

4.1.3.2. macOS

# Make the script executable
chmod +x scripts/build_whl/build-whl-uv-macos.sh

# Build for Python 3.10 (default)
./scripts/build_whl/build-whl-uv-macos.sh

# Build for specific Python version
./scripts/build_whl/build-whl-uv-macos.sh 3.11

# Build for multiple Python versions
./scripts/build_whl/build-whl-uv-macos.sh 3.9 3.10 3.11

# Build all supported versions (3.8-3.13)
./scripts/build_whl/build-whl-uv-macos.sh all

4.1.3.3. Windows

# Build for Python 3.10 (default)
.\scripts\build_whl\build-whl-uv.ps1

# Note: The Windows script currently builds configured versions in the script
# Edit $PythonVersions array in the script to change target versions

4.1.4. Script Options

All build scripts support the following command-line options:

Option Description
--offline Enable offline mode (requires pre-cached dependencies)
--no-clean Skip cleaning build directories before building
--clean Clean build directories before building (default)
--clean-only Only clean build artifacts, don't build
-h, --help Show help message

4.1.4.1. Examples

# Offline build for Python 3.10
./scripts/build_whl/build-whl-uv.sh --offline 3.10

# Clean and build all versions
./scripts/build_whl/build-whl-uv.sh --clean all

# Only clean build artifacts
./scripts/build_whl/build-whl-uv.sh --clean-only

# Build without cleaning (incremental build)
./scripts/build_whl/build-whl-uv.sh --no-clean 3.11

4.1.5. Offline Build

The UV build system supports offline mode, which is useful when building on machines without internet access.

4.1.5.1. Preparing for Offline Build

  1. On a machine with internet access, prepare the offline environment:

# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/orbbec/pyorbbecsdk.git
cd pyorbbecsdk

# Create virtual environments with pybind11 for each Python version
for ver in 3.8 3.9 3.10 3.11 3.12 3.13; do
    uv venv venv${ver//./} --python $ver
    uv pip install pybind11 -e . --python venv${ver//./}/bin/python
done
  1. Copy the entire project directory (including the venv* directories) to the offline machine.

  2. Run the offline build:

./scripts/build_whl/build-whl-uv.sh --offline 3.10

4.1.5.2. How Offline Mode Works

When --offline is specified:

  • The script uses local pybind11 from the venv* directories

  • UV operates in offline mode (UV_OFFLINE=1)

  • No network requests are made during the build

4.1.6. Build Output

After successful build, wheel packages are located in:

pyorbbecsdk/
└── wheel/
    ├── pyorbbecsdk2-2.0.XX-cp38-cp38-linux_x86_64.whl
    ├── pyorbbecsdk2-2.0.XX-cp39-cp39-linux_x86_64.whl
    ├── pyorbbecsdk2-2.0.XX-cp310-cp310-linux_x86_64.whl
    └── ...

4.1.6.1. Installing the Wheel

# Install the wheel package
pip install wheel/pyorbbecsdk2-2.0.XX-cp310-cp310-linux_x86_64.whl

# Verify installation
pip show pyorbbecsdk2 | grep Version

4.1.6.2. Generate Type Stubs (Optional but Recommended)

To generate .pyi type stub files for IDE autocomplete support:

# Activate your virtual environment
source orbbec_env/bin/activate  # Linux/macOS
# .\orbbec_env\Scripts\Activate.ps1  # Windows PowerShell

# Install pybind11-stubgen
pip install pybind11-stubgen

# Generate pyi file
pybind11-stubgen pyorbbecsdk -o .

# Fix the generated pyi file
python scripts/fix_pyi.py pyorbbecsdk.pyi

# Copy the fixed pyi file to the package directory
# (find the package path using pip show)
cp pyorbbecsdk.pyi $(python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))")/

4.1.7. Build Process Details

The build scripts perform the following steps:

  1. Parse Arguments: Process command-line options and Python versions

  2. Architecture Detection: Detect system architecture (x86_64, arm64)

  3. Environment Setup: Configure library paths for the SDK

  4. Cleanup (optional): Remove previous build artifacts

  5. Per-Version Build:

    • Resolve Python interpreter using UV

    • Resolve pybind11 CMake directory

    • Configure with CMake (using appropriate compiler)

    • Build and install targets

    • Copy runtime files (examples, config, stubs)

    • Build wheel package using uv build

    • Repair wheel with auditwheel (Linux only)

  6. Final Cleanup: Remove temporary build directories

4.1.7.1. Key Differences by Platform

Feature Linux macOS Windows
Compiler GCC/G++ Clang/Clang++ MSVC
Library Path LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH
Architecture x86_64, arm64 arm64 x64
Wheel Repair auditwheel None needed None needed
Deployment Target - macOS 13.0+ -

4.1.8. Troubleshooting

4.1.8.1. Common Issues

4.1.8.1.1. “uv: command not found”

Solution: Ensure uv is installed and in your PATH:

# Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"

4.1.8.1.2. “CMake configuration failed”

Solution: Verify CMake version and Python development headers:

# Check CMake version
cmake --version

# Install Python development headers (Linux)
sudo apt-get install python3-dev

4.1.8.1.3. “pybind11 not found” (Offline mode)

Solution: Ensure virtual environments are set up correctly:

# Create venv with pybind11
uv venv venv310 --python 3.10
uv pip install pybind11 --python venv310/bin/python

4.1.8.1.4. “Permission denied” on macOS

Solution: Fix library permissions:

chmod +x scripts/build_whl/build-whl-uv-macos.sh

4.1.8.1.5. Build fails on Windows with “Visual Studio not found”

Solution: Ensure Visual Studio 2019 or 2022 with C++ tools is installed, or specify the generator explicitly:

# In the PowerShell script, modify the cmake command
cmake -G "Visual Studio 17 2022" -A x64 ...

4.1.8.2. Cleaning Build Artifacts

If you encounter persistent build issues, perform a full clean:

# Using the script
./scripts/build_whl/build-whl-uv.sh --clean-only

# Manual cleanup
rm -rf build build_* dist install wheel src/*.egg-info

4.1.9. Advanced Usage

4.1.9.1. Customizing Python Versions

Edit the build script to change default Python versions:

# In scripts/build_whl/build-whl-uv.sh, modify:
PYTHON_VERSIONS=("3.10" "3.11")  # Your desired versions

4.1.9.2. Parallel Builds

The scripts automatically use all available CPU cores:

  • Linux: make -j$(nproc)

  • macOS: make -j$(sysctl -n hw.ncpu)

  • Windows: cmake --build --parallel

4.1.9.3. Environment Variables

Variable Description
UV_LINK_MODE Set to copy for compatibility (default in scripts)
UV_OFFLINE Set to 1 to enable offline mode
MACOSX_DEPLOYMENT_TARGET Minimum macOS version (default: 13.0)

4.1.10. Comparison with Traditional Build

Feature Traditional (pip/venv) UV Build
Python Installation Manual Automatic
Dependency Resolution pip UV (faster)
Virtual Environment Manual Automatic
Offline Support Limited Full support
Cross-Platform Different commands Unified scripts
Build Time Slower Faster

4.1.11. Next Steps

After building the wheel:

  1. Install the wheel: pip install wheel/*.whl

  2. Set up environment: Run scripts/env_setup/install_udev_rules.sh (Linux)

  3. Run examples: See examples/ directory for sample code

  4. Refer to registration script: See registration_script.md for device setup

4.1.12. See Also

  • Install the Package - Installing pre-built wheels

  • Build from Source - Traditional CMake build method

  • UV Documentation

Previous Next

© Copyright 2024, ORBBEC INC. www.orbbec.com.. Last updated on 2026-04-08 16:58:15.