### Run Environment Setup Script (from installed package) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html Run the environment setup script from the installed pyorbbecsdk package (v2.1.0+). First, find the installation path, then execute the setup script. ```bash # 1. Get pyorbbecsdk installation path python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))" # Example output: /path/to/site-packages/pyorbbecsdk # 2. Run setup.py(replace with the path from step 1) python /path/to/site-packages/pyorbbecsdk/shared/setup_env.py ``` -------------------------------- ### Run Quick Start Example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Execute the ready-to-use example script to display live color and depth streams. This requires no configuration. ```bash # Linux/Windows python examples/quick_start.py # macOS sudo -E python examples/quick_start.py ``` -------------------------------- ### Setup Environment from Installed Package Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/README.md Configure the environment using the setup script located within the installed PyOrbbecSDK package. This is a one-time OS-level configuration. ```python # Or from the installed package python $(python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))\)/shared/setup_env.py ``` -------------------------------- ### One-Click Setup for Dependencies and Model Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/examples/applications/object_detection/README.md Installs runtime dependencies and downloads the YOLOv5s ONNX model automatically. Recommended for quick setup. ```bash python setup_model.py ``` -------------------------------- ### Set up Environment (Linux) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt On Linux systems, run this script to install necessary udev rules for device setup after installing the wheel. ```bash scripts/env_setup/install_udev_rules.sh ``` -------------------------------- ### Run Environment Setup Script (Installed Package) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/7_FAQ/FAQ.html Use this method to run the environment setup script from an installed pyorbbecsdk package (v2.1.0+). First, find the installation path, then execute the setup script. ```python python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))" ``` ```python python /path/to/site-packages/pyorbbecsdk/shared/setup_env.py ``` -------------------------------- ### Run Examples (Linux) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_the_package.md.txt Set up the environment by exporting PYTHONPATH and installing udev rules, then run a sample Python script. ```bash cd pyorbbecsdk export PYTHONPATH=$PYTHONPATH:$(pwd)/install/lib/ sudo bash ./scripts/env_setup/install_udev_rules.sh sudo udevadm control --reload-rules && sudo udevadm trigger python3 examples/beginner/02_depth_visualization.py ``` -------------------------------- ### Run Quick Start Example (Python) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Use the zero-config `quick_start.py` script to automatically handle defaults and test frame retrieval, which can help diagnose empty frame issues. ```bash python examples/quick_start.py ``` -------------------------------- ### Run Quick Start Example (macOS) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/3_QuickStarts/QuickStart.html Execute the main quick start script on macOS. Use 'sudo -E' to preserve environment variables, which is often required for running scripts on this platform. ```bash sudo -E python examples/quick_start.py ``` -------------------------------- ### Run a pyorbbecsdk example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Execute a sample Python script from the installed pyorbbecsdk examples. Note the use of 'sudo -E' on macOS. ```bash # Run an example (Linux/Windows) cd /path/to/site-packages/pyorbbecsdk python examples/beginner/02_depth_visualization.py # macOS (requires sudo -E) sudo -E python examples/beginner/02_depth_visualization.py ``` -------------------------------- ### Hello World example for pyorbbecsdk Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt A basic Python script to test the pyorbbecsdk installation by initializing the context, querying devices, and printing device information. ```python # test_installation.py import pyorbbecsdk # Check version (run: pip show pyorbbecsdk2 | grep Version) # or check SDK version with: pyorbbecsdk.get_version() # Initialize context and list devices context = pyorbbecsdk.Context() device_list = context.query_devices() device_count = device_list.get_count() print(f"✓ Found {device_count} Orbbec device(s)") if device_count > 0: device = device_list.get_device_by_index(0) device_info = device.get_device_info() print(f"✓ Device name: {device_info.get_name()}") print(f"✓ Serial number: {device_info.get_serial_number()}") print("\n✅ Installation verified successfully!") ``` -------------------------------- ### Run Beginner Examples Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Execute beginner examples to learn SDK functionalities. Examples are designed to be run sequentially. ```bash python examples/beginner/01_hello_camera.py ``` ```bash python examples/beginner/03_color_and_depth_aligned.py # software align ``` ```bash python examples/beginner/03_color_and_depth_aligned.py --hw # hardware D2C ``` -------------------------------- ### Install example dependencies for older versions Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt For pyorbbecsdk versions prior to 2.1.0, manually install required example dependencies like opencv-python and numpy. ```bash pip install opencv-python numpy ``` -------------------------------- ### Find pyorbbecsdk examples directory Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Locate the directory where pyorbbecsdk examples are installed. ```bash # Find the examples directory python -c "import pyorbbecsdk; import os; print(os.path.dirname(pyorbbecsdk.__file__))" ``` -------------------------------- ### Install Common Dependencies Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html Manually install essential dependencies like OpenCV and NumPy for examples. Install 'onnxruntime' specifically for object detection examples. ```bash pip install opencv-python numpy ``` ```bash pip install onnxruntime ``` -------------------------------- ### Initialize and Start Depth Stream Pipeline Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/5_Application_Guide/ApplicationGuide.html This snippet shows the basic setup for a depth stream, including creating a pipeline, configuring the stream profile, and starting the pipeline with a callback. ```python pipeline = Pipeline() config = Config() profile_list = pipeline.get_stream_profile_list(OBSensorType.DEPTH_SENSOR) depth_profile = profile_list.get_video_stream_profile(640, 400, OBFormat.Y16, 15) config.enable_stream(depth_profile) pipeline.start(config, lambda frames: on_new_frame_callback(frames)) # ... pipeLine.stop() ``` -------------------------------- ### Run Environment Setup Script Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Execute the environment setup script to configure device permissions and register UVC metadata. This can be done from the repository or the installed package. ```bash # Option 1: From repository python scripts/env_setup/setup_env.py # Option 2: From installed package (v2.1.0+) # 1. Get pyorbbecsdk installation path python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))" # Example output: /path/to/site-packages/pyorbbecsdk # 2. Run setup.py(replace with the path from step 1) python /path/to/site-packages/pyorbbecsdk/shared/setup_env.py ``` -------------------------------- ### Find pyorbbecsdk Examples Directory Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html Locate the directory where pyorbbecsdk examples are installed. This is useful for running specific examples. ```python python -c "import pyorbbecsdk; import os; print(os.path.dirname(pyorbbecsdk.__file__))" ``` -------------------------------- ### Install Object Detection Dependency Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Install the `onnxruntime` library, which is specifically required for the object detection example script. ```bash pip install onnxruntime ``` -------------------------------- ### Run Test Example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_the_package.md.txt Execute a Python test example for depth visualization. Ensure you are in the examples directory. ```bash python examples/beginner/02_depth_visualization.py ``` -------------------------------- ### VS Code Autocomplete Example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/stubs/README.md Example demonstrating how to use pyorbbecsdk classes in VS Code. Autocomplete suggestions should appear after starting the pipeline. ```python from pyorbbecsdk import Context, Pipeline, Config pipeline = Pipeline() pipeline.start() # Try typing: you should see autocomplete suggestions ``` -------------------------------- ### Run Environment Setup Script Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html Execute the environment setup script to configure device permissions and register UVC metadata. This is a one-time setup per machine. ```bash # Option 1: From repository python scripts/env_setup/setup_env.py ``` ```python # Option 2: From installed package (v2.1.0+) # 1. Get pyorbbecsdk installation path python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))" # Example output: /path/to/site-packages/pyorbbecsdk # 2. Run setup.py(replace with the path from step 1) python /path/to/site-packages/pyorbbecsdk/shared/setup_env.py ``` -------------------------------- ### Linux OS Setup for Hardware Tests Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/test/README.md Install udev rules on Linux to allow the SDK to open USB devices. This is a one-time setup required for hardware tests. ```bash cd scripts/env_setup && sudo ./install_udev_rules.sh sudo udevadm control --reload && sudo udevadm trigger ``` -------------------------------- ### Install uv on Linux/macOS Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt Installs uv using a curl command. Ensure you follow the official uv installation guide for the most up-to-date instructions. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Run Environment Setup Script (Windows) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Execute the environment setup script on Windows to register UVC metadata, which helps resolve timestamp or frame synchronization issues. This is a one-time setup per device/computer. ```bash python scripts/env_setup/setup_env.py ``` -------------------------------- ### Install Python Dependencies Manually Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/examples/applications/object_detection/README.md Installs necessary Python libraries if manual setup is preferred over the one-click script. ```bash pip install numpy opencv-python onnxruntime ``` -------------------------------- ### Get Platform Information for Wheel Selection Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/7_FAQ/FAQ.html Determine your system's architecture and operating system to download the correct wheel file for offline installation. ```python python3 -c "import platform; print(platform.machine()); print(platform.system())" ``` ```python python -c "import platform; print(platform.machine()); print(platform.system())" ``` -------------------------------- ### Run environment setup script (Linux/macOS) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Execute the environment setup script to resolve potential 'No device found' issues on Linux systems. ```bash # Option 1: From repository python scripts/env_setup/setup_env.py # Option 2: From installed package (v2.1.0+) # 1. Get pyorbbecsdk installation path python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))" # Example output: /path/to/site-packages/pyorbbecsdk ``` -------------------------------- ### Install the Package After Building Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/build_the_package.html After successfully building the package, use this command to install it. This command installs the package in the current Python environment. ```bash python setup.py install ``` -------------------------------- ### Install the Wheel Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt After building the wheel, use this command to install it. Ensure you are in the correct directory. ```bash pip install wheel/*.whl ``` -------------------------------- ### Install Built Wheel Package Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_with_uv.md.txt Install the generated wheel package using pip. Verify the installation by checking the package version. ```bash # Install the wheel package pip install wheel/pyorbbecsdk2-2.0.XX-cp310-cp310-linux_x86_64.whl # Verify installation pip show pyorbbecsdk2 | grep Version ``` -------------------------------- ### Install pyorbbecsdk and Requirements Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/examples/README.md Install the pyorbbecsdk library and its dependencies from the requirements file. ```bash pip install pyorbbecsdk2 pip install -r examples/requirements.txt ``` -------------------------------- ### Setup Environment for Windows Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/README.md Run the environment setup script on Windows using PowerShell. This is a one-time OS-level configuration for metadata and udev rules. ```powershell # From the repository # Windows (PowerShell — will auto-request Administrator) python scripts/env_setup/setup_env.py ``` -------------------------------- ### Install uv package manager Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/7_FAQ/FAQ.html Install the 'uv' command-line tool if it's not found. This script downloads and installs uv, and then updates your PATH environment variable. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh export PATH="$HOME/.local/bin:$PATH" source ~/.bashrc # or ~/.zshrc ``` -------------------------------- ### Download and Install Miniconda on Linux Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/virtual_environment_guide.md.txt Installs Miniconda on Linux systems by downloading the installer script and executing it. This is the first step for using conda environments. ```bash wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh ``` -------------------------------- ### Install Dependencies (Windows) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_the_package.md.txt Install project dependencies using pip after cloning the repository. ```python pip3 install -r requirements.txt ``` -------------------------------- ### Run the installation verification script Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Execute the 'Hello World' Python script to verify the pyorbbecsdk installation. Note the use of 'sudo -E' on macOS. ```bash # Linux/Windows python test_installation.py # macOS (requires sudo -E, see note below) sudo -E python test_installation.py ``` -------------------------------- ### Get pyorbbecsdk installation path Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/registration_script.md.txt Use this command to find the installation path of the pyorbbecsdk package, which is needed to locate the setup script when installed via pip. ```python import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__)) ``` -------------------------------- ### Install Dependencies (Ubuntu) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_the_package.md.txt Install necessary Python development packages on Ubuntu systems. ```bash sudo apt-get install python3-dev python3-venv python3-pip python3-opencv ``` -------------------------------- ### Install and Verify PyOrbbecSDK on Windows Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/virtual_environment_guide.html After activating the virtual environment, install and verify the PyOrbbecSDK using pip on Windows. ```powershell # Install SDK pip install --upgrade pyorbbecsdk2 # Verify installation pip show pyorbbecsdk2 | findstr Version ``` -------------------------------- ### Run LiDAR Quick Start Script Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/examples/README.md Executes the minimal LiDAR streaming script, a starting point for LiDAR users. ```bash python examples/lidar_examples/lidar_quick_start.py ``` -------------------------------- ### Install pyorbbecsdk using pip (Linux/macOS) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt After activating the virtual environment, install or upgrade the pyorbbecsdk package from PyPI. ```bash # Install SDK pip install --upgrade pyorbbecsdk2 ``` -------------------------------- ### Run Firmware Update Example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/7_FAQ/FAQ.md.txt Execute the firmware update example script to manually update the camera's firmware. Ensure the camera is connected via USB and follow the on-screen prompts. ```bash python examples/beginner/09_device_firmware_update.py ``` -------------------------------- ### Install uv on Windows PowerShell Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt Installs uv using a PowerShell command. Ensure you follow the official uv installation guide for the most up-to-date instructions. ```powershell powershell -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Run Environment Setup Script (from repository) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html Execute the environment setup script located in the repository to resolve 'No device found' issues on Linux. This script helps configure necessary permissions and rules. ```bash # Option 1: From repository python scripts/env_setup/setup_env.py ``` -------------------------------- ### Complete Workflow Example with venv Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/virtual_environment_guide.html Demonstrates the typical workflow for using a virtual environment with pyorbbecsdk, including activation and deactivation. ```bash # Enter project directory cd ~/projects/orbbec_demo # Python automatically switches to 3.10.16 (via .python-version) python --version # Python 3.10.16 # Activate virtual environment source orbbec_env/bin/activate # Run program python your_script.py # Exit deactivate ``` -------------------------------- ### Run setup_env.py on Windows Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/registration_script.md.txt Navigate to the script directory and execute `setup_env.py` using Python. Administrator privileges may be requested automatically. ```powershell cd pyorbbecsdk/scripts/env_setup python setup_env.py ``` -------------------------------- ### Install UV and Prepare Offline Environment Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/build_with_uv.html Installs UV using curl, clones the repository, and creates virtual environments with pybind11 for multiple Python versions, preparing for an offline build. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh git clone https://github.com/orbbec/pyorbbecsdk.git cd pyorbbecsdk 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 ``` -------------------------------- ### Install udev rules for USB device access on Linux Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/7_FAQ/FAQ.md.txt Manually install udev rules to grant your user permission to access USB devices. This is an alternative to running the setup script and requires root privileges. ```bash lsusb | grep 2bc5 ``` ```bash sudo nano /etc/udev/rules.d/99-obsensor-libusb.rules ``` ```bash SUBSYSTEM=="usb", ATTR{idProduct சேன}=="your_pid_here", ATTR{idVendor சேன}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video" ``` ```bash sudo udevadm control --reload-rules && sudo service udev restart && sudo udevadm trigger ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/README.md Set up a Python virtual environment to manage dependencies and avoid system-wide permission issues. Activate the environment before installing the SDK. ```bash # Create and activate virtual environment python3 -m venv orbbec_env source orbbec_env/bin/activate # Linux/macOS # .\orbbec_env\Scripts\Activate.ps1 # Windows PowerShell # Install SDK in virtual environment pip install --upgrade pyorbbecsdk2 ``` -------------------------------- ### Setup Environment for Linux Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/README.md Run the environment setup script on Linux using python3. This is a one-time OS-level configuration for metadata and udev rules and will auto-request sudo. ```bash # From the repository # Linux (will auto-request sudo) python3 scripts/env_setup/setup_env.py ``` -------------------------------- ### Install and Verify PyOrbbecSDK Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/7_FAQ/FAQ.html Install or upgrade the PyOrbbecSDK using pip and then verify the installation by checking the installed version. This is crucial for resolving ModuleNotFoundError. ```bash pip install --upgrade pyorbbecsdk2 ``` ```bash pip show pyorbbecsdk2 | grep Version ``` -------------------------------- ### Run setup_env.py on macOS Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/registration_script.md.txt Navigate to the script directory and execute `setup_env.py`. The script will detect macOS and indicate that no additional setup is required. ```bash cd pyorbbecsdk/scripts/env_setup python setup_env.py # Output: macOS detected. No additional environment setup required. ``` -------------------------------- ### Install and Verify PyOrbbecSDK Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/7_FAQ/FAQ.md.txt To resolve `ModuleNotFoundError: No module named 'pyorbbecsdk'`, install or upgrade the SDK using pip. Verify the installation by checking the installed version. ```bash # Install the SDK pip install --upgrade pyorbbecsdk2 # Verify installation pip show pyorbbecsdk2 | grep Version ``` -------------------------------- ### Run setup_env.py from installed package Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/registration_script.md.txt Execute the `setup_env.py` script using its full path obtained from the pyorbbecsdk installation directory. This is an alternative to running it from the source repository. ```python python /path/to/site-packages/pyorbbecsdk/shared/setup_env.py ``` -------------------------------- ### Build pyorbbecsdk Project (Linux) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_the_package.md.txt Create a virtual environment, install requirements, configure CMake, and build the project using make. ```bash cd pyorbbecsdk python3 -m venv ./venv source venv/bin/activate pip3 install -r requirements.txt mkdir build cd build cmake -Dpybind11_DIR=`pybind11-config --cmakedir` .. make -j4 make install ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/test/README.md Install necessary dependencies for running the test suite. This command should be run after installing the pyorbbecsdk. ```bash pip install -r test/requirements_test.txt ``` -------------------------------- ### Installation Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html To install the pyorbbecsdk package, you can use pip. This command will download and install the latest version of the package and its dependencies. ```APIDOC ## Install pyorbbecsdk ### Description Installs the pyorbbecsdk package using pip. ### Method `pip install` ### Endpoint N/A (Command-line operation) ### Parameters None ### Request Example ```bash pip install pyorbbecsdk ``` ### Response Success message indicating successful installation. ``` -------------------------------- ### Run Color and Depth Aligned Example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/3_QuickStarts/QuickStart.html Executes the 'color_and_depth_aligned.py' script to demonstrate color and depth stream alignment. Use --hw for hardware alignment. ```python python examples/beginner/03_color_and_depth_aligned.py # software align ``` ```python python examples/beginner/03_color_and_depth_aligned.py --hw # hardware D2C ``` -------------------------------- ### Install pyorbbecsdk2 (Python) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Install or upgrade the pyorbbecsdk and its dependencies using pip to resolve 'ModuleNotFoundError'. Verify the installation afterwards. ```bash pip install --upgrade pyorbbecsdk2 pip show pyorbbecsdk2 | grep Version ``` -------------------------------- ### Run Beginner Script Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/examples/README.md Executes the first script in the beginner series. ```bash python examples/beginner/01 ``` -------------------------------- ### Create Device using Index Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/5_Application_Guide/ApplicationGuide.html Method 1 demonstrates enumerating devices via Context and selecting one by its index. This is suitable for use cases involving multiple devices. ```python from pyorbbecsdk import * # Create a Context ctx = Context() # Method 1 # Enumerate all connected devices through the Context. device_list = ctx.query_devices() # Get the device at index 0. device = device_list.get_device_by_index(0) ``` -------------------------------- ### Install uv Command-Line Tool Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/7_FAQ/FAQ.md.txt Install the 'uv' command-line tool using a script and add its binary directory to your PATH. This resolves 'uv: command not found' errors during builds. ```bash # Install uv (if not already installed) curl -LsSf https://astral.sh/uv/install.sh | sh # Add to ~/.bashrc or ~/.zshrc export PATH="$HOME/.local/bin:$PATH" # Reload shell configuration source ~/.bashrc # or ~/.zshrc ``` -------------------------------- ### Prepare for offline build Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt Installs uv and clones the repository on a machine with internet access to prepare for an offline build. This step caches dependencies. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh git clone https://github.com/orbbec/pyorbbecsdk.git cd pyorbbecsdk ``` -------------------------------- ### Install pyorbbecsdk from Wheel File Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/2_installation/install_the_package.html Install the pyorbbecsdk package using a downloaded wheel file. This method is suitable for offline installations or specific version requirements. ```bash pip install pyorbbecsdk-*.whl ``` -------------------------------- ### Install udev Rules (Linux) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Install udev rules to ensure camera detection and avoid permission errors on Linux. This can be done from the repository or an installed package. ```bash python scripts/env_setup/setup_env.py ``` ```bash python -c "import pyorbbecsdk, os; print(os.path.dirname(pyorbbecsdk.__file__))" # Example output: /path/to/site-packages/pyorbbecsdk python /path/to/site-packages/pyorbbecsdk/shared/setup_env.py ``` -------------------------------- ### Download and Install Miniconda on macOS (Apple Silicon) Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/virtual_environment_guide.md.txt Installs Miniconda on macOS with Apple Silicon architecture. Download the specific installer and run it using bash. ```bash wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh bash Miniconda3-latest-MacOSX-arm64.sh ``` -------------------------------- ### Run Recorder Example Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/source/3_QuickStarts/QuickStart.html Executes the 'recorder.py' script to record all streams to a .bag file. Supports GUI preview or headless operation. ```python python examples/advanced/01_recorder.py # with live preview ``` ```python python examples/advanced/01_recorder.py --no-gui # headless ``` -------------------------------- ### Install Wheel Package Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt After a successful build, install the generated wheel package using pip. This command installs the wheel for a specific Python version (e.g., cp310). ```bash pip install wheel/pyorbbecsdk2-2.0.XX-cp310-cp310-linux_x86_64.whl ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/install_the_package.md.txt Set up a Python virtual environment to manage dependencies. Activate it using `source orbbec_env/bin/activate` on Linux/macOS or `orbbec_env\Scripts\activate` on Windows. ```bash # Create virtual environment python3 -m venv orbbec_env # Activate (Linux/macOS) source orbbec_env/bin/activate # Activate (Windows) orbbec_env\Scripts\activate ``` -------------------------------- ### Verify pyenv Installation Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/virtual_environment_guide.md.txt Checks if pyenv has been installed correctly by displaying its version. ```bash pyenv --version ``` -------------------------------- ### Verify pyorbbecsdk2 Installation Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/virtual_environment_guide.md.txt Checks the installed version and details of the pyorbbecsdk2 package. ```bash pip show pyorbbecsdk2 ``` -------------------------------- ### Prepare for Offline Build Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/4_Package/build_with_uv.md.txt Prepare the environment for an offline build by installing UV, cloning the repository, and creating virtual environments with pybind11 for each Python version. ```bash # 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 ``` -------------------------------- ### Verify Installation Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Check if the pyorbbecsdk2 package is installed correctly by running this command in your terminal. ```bash # Linux/Windows/macOS pip show pyorbbecsdk2 | grep Version ``` -------------------------------- ### Prepare Offline Environment with pybind11 Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/7_FAQ/FAQ.md.txt On a machine with internet access, create virtual environments and install 'pybind11' and the project in editable mode for each Python version. Then, copy the project and virtual environments to the offline machine. ```bash # On a machine with internet access, prepare the offline environment: 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 # Then copy the entire project directory (including venv* directories) to the offline machine ``` -------------------------------- ### Verify uv installation Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/2_installation/build_with_uv.md.txt Checks if uv has been installed correctly by displaying its version number. ```bash uv --version ``` -------------------------------- ### Initialize Pipeline and Configure Hardware D2C Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/5_Application_Guide/ApplicationGuide.md.txt This snippet demonstrates initializing a pipeline, configuring color and hardware-aligned depth streams, and setting the alignment mode to hardware. ```python from pyorbbecsdk import * def main(): # 1.Create a pipeline with default device. pipeline = Pipeline() # 2.Create config. config = Config() # 3.Get the list of color stream profiles profile_list = pipeline.get_stream_profile_list(OBSensorType.COLOR_SENSOR) # Iterate through the color stream profiles for i in range(len(profile_list)): color_profile = profile_list[i] # Check if the color format is RGB if color_profile.get_format() != OBFormat.RGB: continue # Get the list of hardware aligned depth-to-color profiles hw_d2c_profile_list = pipeline.get_d2c_depth_profile_list(color_profile, OBAlignMode.HW_MODE) if len(hw_d2c_profile_list) == 0: continue # Get the first hardware aligned depth-to-color profile hw_d2c_profile = hw_d2c_profile_list[0] print("hw_d2c_profile: ", hw_d2c_profile) # 4.Enable the depth and color streams config.enable_stream(hw_d2c_profile) config.enable_stream(color_profile) # 5.Set the alignment mode to hardware alignment config.set_align_mode(OBAlignMode.HW_MODE) break else: return # 6.Start the pipeline pipeline.start(config) while True: # 7.Wait for frames frames = pipeline.wait_for_frames(100) if frames is None: continue # Get the color and depth frames color_frame = frames.get_color_frame() depth_frame = frames.get_depth_frame() # 8.Stop the pipeline pipeline.stop() ``` -------------------------------- ### Verify Camera Connection Source: https://github.com/orbbec/pyorbbecsdk/blob/v2-main/docs/_sources/source/3_QuickStarts/QuickStart.md.txt Run this script to ensure your camera is connected and recognized by the SDK before proceeding with the main quick start. ```bash python examples/beginner/01_hello_camera.py ```