RealSense、ZED 和奥比中光Astra几款主流相机先容及应用

立山  论坛元老 | 2024-10-1 18:28:58 | 来自手机 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 1860|帖子 1860|积分 5580

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
以下是英特尔 RealSense、Stereolabs ZED 和奥比中光Astra几款相机的详细对比,包罗参数、性能以及二次开发等支持,附带代码示例。
详细信息对比和二次开发示例

1. 英特尔 RealSense (例如 D435/D455)



  • 深度技术:立体视觉 + 红外投影
  • 分辨率

    • D435: 1280x720 @ 30fps
    • D455: 1920x1080 @ 30fps

  • 工作范围:0.2 米到 10 米
  • 视场角 (FOV):宽度 86°,高度 57°
  • 通讯接口:USB 3.0
  • SDK 支持: Intel RealSense SDK
  • 二次开发支持:C++, Python, ROS 等
  • 安装依赖
  1. pip install pyrealsense2
复制代码
代码示例(Python)
  1. import pyrealsense2 as rs
  2. import numpy as np
  3. import cv2
  4. # 创建管道
  5. pipeline = rs.pipeline()
  6. # 配置流
  7. config = rs.config()
  8. config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
  9. config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
  10. # 启动流
  11. pipeline.start(config)
  12. try:
  13.     while True:
  14.         frames = pipeline.wait_for_frames()
  15.         depth_frame = frames.get_depth_frame()
  16.         color_frame = frames.get_color_frame()
  17.         if not depth_frame or not color_frame:
  18.             continue
  19.         # 将帧转换为numpy数组
  20.         depth_image = np.asanyarray(depth_frame.get_data())
  21.         color_image = np.asanyarray(color_frame.get_data())
  22.         # 显示图像
  23.         cv2.imshow('Color', color_image)
  24.         cv2.imshow('Depth', depth_image)
  25.         if cv2.waitKey(1) & 0xFF == ord('q'):
  26.             break
  27. finally:
  28.     pipeline.stop()
  29.     cv2.destroyAllWindows()
复制代码
代码示例(C++)
  1. #include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
  2. #include <iostream>
  3. int main() {
  4.     // Create a RealSense pipeline
  5.     rs2::pipeline p;
  6.     // Start the pipeline with default configuration
  7.     p.start();
  8.     while (true) {
  9.         // Wait for a new frame
  10.         rs2::frameset frames = p.wait_for_frames();
  11.         // Get the depth frame
  12.         rs2::depth_frame depth = frames.get_depth_frame();
  13.         // Get the color frame
  14.         rs2::frame color = frames.get_color_frame();
  15.         if (!depth || !color) continue;
  16.         // Get the dimensions of the image
  17.         int width = depth.get_width();
  18.         int height = depth.get_height();
  19.         std::cout << "Depth Frame: " << width << "x" << height << std::endl;
  20.         // Process the images (for demonstration, we just print the size)
  21.         // Here you can add your own image processing code
  22.         // Break the loop on a specific condition (e.g., pressing a key)
  23.         // For this example, we'll just run indefinitely
  24.     }
  25.     return 0;
  26. }
复制代码
2. ZED (Stereolabs)



  • 深度技术:立体视觉 + IMU
  • 分辨率

    • ZED 2: 4416x1242 @ 15fps(720p模式约 60fps)

  • 工作范围:0.5 米到 20 米
  • 视场角 (FOV):水平 110°,垂直 75°
  • 通讯接口:USB 3.0
  • SDK 支持:ZED SDK
  • 二次开发支持:C++, Python, Unity, ROS 等
    安装依赖
    参考 ZED SDK 安装指南
代码示例(Python)
  1. import sys
  2. import time
  3. import pyzed.sl as sl
  4. # 创建相机对象
  5. zed = sl.Camera()
  6. # 配置相机
  7. init_params = sl.InitParameters()
  8. init_params.camera_resolution = sl.RESOLUTION.HD720
  9. init_params.depth_mode = sl.DEPTH_MODE.PERFORMANCE
  10. zed.open(init_params)
  11. while True:
  12.     # 捕获图像
  13.     if zed.grab() == sl.ERROR_CODE.SUCCESS:
  14.         image = sl.Mat()
  15.         zed.retrieve_image(image, sl.VIEW.COLOR)
  16.         depth = sl.Mat()
  17.         zed.retrieve_measure(depth, sl.MEASURE.DEPTH)
  18.         # 获取图像数据
  19.         image_ocv = image.get_data()
  20.         depth_ocv = depth.get_data()
  21.         # 显示图像
  22.         cv2.imshow("ZED Color", image_ocv)
  23.         cv2.imshow("ZED Depth", depth_ocv)
  24.         
  25.         if cv2.waitKey(1) & 0xFF == ord('q'):
  26.             break
  27. # 关闭相机
  28. zed.close()
复制代码
代码示例(C++)
  1. #include <sl/Camera.hpp>
  2. int main(int argc, char **argv) {
  3.     sl::Camera zed;
  4.     sl::InitParameters init_params;
  5.     init_params.camera_resolution = sl::RESOLUTION::HD720;
  6.     init_params.depth_mode = sl::DEPTH_MODE::PERFORMANCE;
  7.     // 开始相机
  8.     if (zed.open(init_params) != sl::ERROR_CODE::SUCCESS) {
  9.         std::cerr << "Error opening ZED camera." << std::endl;
  10.         return EXIT_FAILURE;
  11.     }
  12.     sl::Mat image, depth;
  13.     while (true) {
  14.         if (zed.grab() == sl::ERROR_CODE::SUCCESS) {
  15.             zed.retrieveImage(image, sl::VIEW::LEFT);
  16.             zed.retrieveMeasure(depth, sl::MEASURE::DEPTH);
  17.             // 显示图像和深度
  18.             cv::imshow("ZED Image", image.getCvMat());
  19.             cv::imshow("ZED Depth", depth.getCvMat());
  20.             if (cv::waitKey(1) == 'q') break;
  21.         }
  22.     }
  23.     zed.close();
  24.     return EXIT_SUCCESS;
  25. }
复制代码
3. 奥比中光(Orbbec)



  • 深度技术:结构光
  • 分辨率

    • Astra: 640x480 @ 30fps
    • Astra Pro: 1280x720 @ 30fps

  • 工作范围:0.4 米到 8 米
  • 视场角 (FOV):水平 60°,垂直 49°
  • 通讯接口:USB 2.0 / USB 3.0
  • SDK 支持:奥比中光 SDK
  • 二次开发支持:C++, C#, Python, Unity 等
  • 安装依赖
    参考 奥比中光 SDK 安装指南
代码示例(Python)
  1. import numpy as np
  2. import cv2
  3. import openni2
  4. # 初始化
  5. openni2.initialize()
  6. dev = openni2.Device.open_any()
  7. depth_stream = dev.create_depth_stream()
  8. color_stream = dev.create_color_stream()
  9. # 开启流
  10. depth_stream.start()
  11. color_stream.start()
  12. while True:
  13.     depth_frame = depth_stream.read_frame()
  14.     color_frame = color_stream.read_frame()
  15.     depth_data = np.frombuffer(depth_frame.get_buffer_as_uint16(), dtype=np.uint16)
  16.     color_data = np.frombuffer(color_frame.get_buffer_as_uint8(), dtype=np.uint8)
  17.     # 处理深度数据
  18.     depth_image = depth_data.reshape((depth_frame.height, depth_frame.width))
  19.     color_image = color_data.reshape((color_frame.height, color_frame.width, 3))
  20.     # 显示图像
  21.     cv2.imshow('Color Image', color_image)
  22.     cv2.imshow('Depth Image', depth_image)
  23.     if cv2.waitKey(1) & 0xFF == ord('q'):
  24.         break
  25. # 停止流
  26. depth_stream.stop()
  27. color_stream.stop()
  28. openni2.unload()
复制代码
代码示例(C++)
  1. #include <OpenNI.h>
  2. #include <iostream>
  3. int main() {
  4.     openni::OpenNI::initialize();
  5.     openni::Device device;
  6.     if (device.open(openni::ANY_DEVICE) != openni::STATUS_OK) {
  7.         std::cerr << "Could not open device." << std::endl;
  8.         return -1;
  9.     }
  10.     openni::VideoStream depthStream, colorStream;
  11.     depthStream.create(device, openni::SENSOR_DEPTH);
  12.     colorStream.create(device, openni::SENSOR_COLOR);
  13.     depthStream.start();
  14.     colorStream.start();
  15.     openni::VideoFrameRef depthFrame, colorFrame;
  16.     while (true) {
  17.         depthStream.readFrame(&depthFrame);
  18.         colorStream.readFrame(&colorFrame);
  19.         // 显示深度和颜色
  20.         // 需添加显示代码 (如使用 OpenCV)
  21.         
  22.         if (/* 检测退出条件 */) break;
  23.     }
  24.     depthStream.stop();
  25.     colorStream.stop();
  26.     device.close();
  27.     openni::OpenNI::shutdown();
  28.     return 0;
  29. }
复制代码
综合参数对比

参数英特尔 RealSenseStereolabs ZED奥比中光深度技术立体视觉 + 红外投影立体视觉 + IMU结构光分辨率D435: 1280x720; D455: 1920x1080ZED 2: 4416x1242Astra: 640x480; Pro: 1280x720工作范围0.2 米到 10 米0.5 米到 20 米0.4 米到 8 米视场角 (FOV)86° x 57°110° x 75°60° x 49°通讯接口USB 3.0USB 3.0USB 2.0 / USB 3.0SDKIntel RealSense SDKZED SDK奥比中光 SDK二次开发支持丰富的文档与社区详细API与示例文档与多平台支持 参数Intel RealSense D435iZED Mini奥比中光 Astra Pro分辨率1280x720 (RGB), 640x480 (Depth)1280x720 (RGB), 720p (Depth)1280x720 (RGB), 640x480 (Depth)深度范围0.3m - 10m0.3m - 20m0.5m - 8m帧率30 fps (depth + RGB)60 fps (depth + RGB)30 fps (depth + RGB)通讯接口USB 3.0USB 3.0USB 3.0视场角69.4° x 42.5°110° x 80°90° x 60° 综合性能对比



  • 盘算本领:

    • RealSense 配备 IMU,适合移动装备和呆板人。
    • ZED 提供高精度深度数据和较大的视场角,适合 AR/VR 应用。
    • 奥比中光专注于深度图像和手势识别等应用,适合人机交互。

  • 使用场景:

    • RealSense: 呆板人视觉、手势识别。
    • ZED: 虚拟现实、增强现实、3D 映射。
    • 奥比中光: 智能家居、互动游戏。

总结

以上是对三种不同厂家相机的基本信息对比及二次开发示例,可作为小白简朴相识和熟悉。不同的项目需求可以选择不同的相机,根据详细应用场景进行开发

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

立山

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表