realsenseai/librealsense

GitHub: realsenseai/librealsense

RealSense SDK 2.0 是一个跨平台的开源库,用于驱动 RealSense 深度相机并提供深度及彩色数据流的采集与处理能力。

Stars: 8696 | Forks: 4994

Logo for light mode Logo for dark mode

RealSense SDK 2.0 是一个用于 RealSense 深度相机的跨平台库。 该 SDK 支持深度和彩色数据流,并提供内参和外参校准信息。

License Latest release Commits since Issues GitHub CI Forks

## 重要通知 很高兴地通知您,RealSense GitHub 仓库已成功迁移至 RealSenseAI 组织。 请务必将您的链接更新至新的 RealSenseAI 组织,以便克隆仓库及访问其中的特定文件。 [https://github.com/**IntelRealSense**/librealsense](https://github.com/IntelRealSense/librealsense) --> [https://github.com/**realsenseai**/librealsense](https://github.com/realsenseai/librealsense) #### 分支策略 我们已更新分支策略: 从现在起,我们也将把 beta 版本推送到 master 分支,以便用户获取最新的代码和功能。 在不久的将来,beta 版二进制文件也将被推送到公共分发服务器(例如 APT)。 最新经过验证的官方版本可以在我们的 GitHub Releases 页面找到。 ## 使用案例 以下是一些由 RealSense 技术驱动的真实应用案例: 机器人 | 深度感知 | 3D 扫描 | :------------: | :----------: | :-------------: | | | 无人机 | 骨骼与人员追踪 | 人脸认证 | :--------------------------: | :-----: | :----------------------: | | | ## 为何选择 RealSense? - **近距离和远距离的高分辨率彩色与深度**成像 - **开源 SDK**,包含丰富的示例和封装库(Python, ROS, C#, Unity 以及[更多...](https://github.com/realsenseai/librealsense/tree/master/wrappers)) - **活跃的开发者社区,以及机器人领域事实标准的 3D 立体相机** - **跨平台**支持:Windows、Linux、macOS、Android 和 Docker ## 产品系列 RealSense 立体深度产品利用立体视觉计算深度,在各种光照和环境条件下提供高质量性能。 以下是一些支持的型号示例: | 产品 | 图片 | 描述 | |---------|-------|-------------| | [**D555 PoE**](https://realsenseai.com/ruggedized-industrial-stereo-depth/d555-poe/) | | RealSense™ 深度相机 D555 引入了片上以太网供电 接口,扩展了我们 USB 和 GMSL/FAKRA 产品的产品组合。 | | [**D457 GMSL/FAKRA**](https://realsenseai.com/ruggedized-industrial-stereo-depth/d457-gmsl-fakra/) | | RealSense™ 深度相机 D457 是我们首款 GMSL/FAKRA 高带宽立体相机。D457 具有 IP65 等级防护外壳,可防止灰尘进入和喷水。 | | [**D455**](https://realsenseai.com/stereo-depth-cameras/real-sense-depth-camera-d455/) | | RealSense D455 是一款长距离立体深度相机,具有 95 mm 基线、全局快门深度传感器、RGB 传感器和内置 IMU,可在远达 10 m 的距离提供准确的深度数据。 | | [**D435if**](https://realsenseai.com/stereo-depth-cameras/depth-camera-d435i/) | | D435if 是 [RealSense™ 带 IR 滤光片的深度相机系列](https://realsenseai.com/stereo-depth-with-ir-pass-filter/) 的一员,扩展了我们针对不断增长的机器人市场的产品组合。D400f 系列利用 IR 滤光片在许多机器人环境中增强深度质量和性能范围。| | [**D405**](https://realsenseai.com/stereo-depth-cameras/stereo-depth-camera-d405/) | | RealSense™ 深度相机 D405 是一款短距离立体相机,为您的近距离计算机视觉需求提供亚毫米级精度。 | ## 快速入门 使用以下任一方法,在几分钟内即可开始使用 RealSense 进行开发。 ### 1️. 预编译 SDK 如果您想插上相机并立即开始使用,这是最佳选择。 1. 从 [Releases 页面](https://github.com/realsenseai/librealsense/releases) 下载最新的 SDK 包。 2. 连接您的 RealSense 相机。 3. 运行包含的工具: - [RealSense Viewer](./tools/realsense-viewer/): 查看数据流、调整设置、录制和回放。 - [Depth Quality Tool](./tools/depth-quality/): 测量精度和填充率。 ### 安装指南 - 预编译 SDK Linux\Jetson Guide Windows Guide ### 2️. 从源代码构建 如需更自定义的安装,请按照以下步骤从源代码构建 SDK。 1. 克隆仓库并创建构建目录: git clone https://github.com/realsenseai/librealsense.git cd librealsense mkdir build && cd build 2. 运行 CMake 配置构建: cmake .. 3. 构建项目: cmake --build . ### 安装指南 - 从源代码构建 Linux Guide Jetson Guide Windows Guide macOS Guide ## Python 包 [![pyrealsense2](https://img.shields.io/pypi/v/pyrealsense2.svg?label=pyrealsense2&logo=pypi)](https://pypi.org/project/pyrealsense2/) [![PyPI - pyrealsense2-beta](https://img.shields.io/pypi/v/pyrealsense2-beta.svg?label=pyrealsense2-beta&logo=pypi)](https://pypi.org/project/pyrealsense2-beta/) **我应该使用哪一个?** - **Stable(稳定版):** `pyrealsense2` — 与 SDK 标签对齐的经过验证的发布版本(推荐大多数用户使用)。 - **Beta(测试版):** `pyrealsense2-beta` — 用于抢先体验和测试的较新构建版本。更新频率更快。 ### 安装 ``` pip install pyrealsense2 # Stable pip install pyrealsense2-beta # Beta ``` ## 准备开始开发! 我们的库为使用 RealSense 深度相机提供了高级 API(以及低级 API)。 以下代码片段展示了如何开始流式传输帧并提取像素的深度值: **C++** ``` #include #include int main() { rs2::pipeline p; // Top-level API for streaming & processing frames p.start(); // Configure and start the pipeline while (true) { rs2::frameset frames = p.wait_for_frames(); // Block until frames arrive rs2::depth_frame depth = frames.get_depth_frame(); // Get depth frame if (!depth) continue; int w = depth.get_width(), h = depth.get_height(); float dist = depth.get_distance(w/2, h/2); // Distance to center pixel std::cout << "The camera is facing an object " << dist << " meters away\r"; } } ``` **Python** ``` import pyrealsense2 as rs pipeline = rs.pipeline() # Create a pipeline pipeline.start() # Start streaming try: while True: frames = pipeline.wait_for_frames() depth_frame = frames.get_depth_frame() if not depth_frame: continue width, height = depth_frame.get_width(), depth_frame.get_height() dist = depth_frame.get_distance(width // 2, height // 2) print(f"The camera is facing an object {dist:.3f} meters away", end="\r") finally: pipeline.stop() # Stop streaming ``` 有关该库的更多信息,请查看我们的[示例](./examples)或[工具](./tools/),并阅读[文档](./doc)以了解更多内容。 ## 支持的平台 ### 操作系统和平台 | Ubuntu | Windows | macOS High Sierra | Jetson | Raspberry Pi | |--------|---------|-------|--------|----------------| |
Ubuntu
|
Windows
|
macOS
|
|
| ### 编程语言和封装库 | C++ | C | C# | Python | ROS 2 |Rest API | |-----|---|----|--------|-------|---------| |
|
|
|
|
ROS 2
|
Rest API
| 平台和封装库,请查看[这里](https://dev.realsenseai.com/docs/docs-get-started)。 ## 社区与支持 - [📚 Wiki 和文档](https://github.com/realsenseai/librealsense/wiki) - [🐞 报告问题](https://github.com/realsenseai/librealsense/issues)- 发现了错误或想要做出贡献?请阅读我们的[贡献指南](./CONTRIBUTING.md)。

You can find us at

GitHub     X (Twitter)     YouTube     LinkedIn     Community

标签:3D视觉, Bash脚本, C++, Intel RealSense, librealsense, Python, RealSense, RGB-D, ROS, ROS2, 人脸识别, 传感器, 内参, 图像处理, 外参, 开源, 手势识别, 数据擦除, 无后门, 标定, 流媒体, 测量, 深度摄像头, 深度相机, 点云, 物体追踪, 视觉SLAM, 计算机视觉, 逆向工具