首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >关于RGBD相机选型(奥比中光)

关于RGBD相机选型(奥比中光)

作者头像
云深无际
发布2021-10-08 11:05:55
发布2021-10-08 11:05:55
2.2K0
举报
文章被收录于专栏:云深之无迹云深之无迹

这篇文章有两个星期了,我忘了发了,是关于一些选型的资料,这里做一点小整理发到这里。

因为参加了奥比中光和英伟达联合举办的三维相机比赛,然后现在要拿方案选型,所以这里就做个记录,资料来源于官网和互联网。

代码语言:javascript
复制
https://www.orbbec.com.cn/

主要是这两个产品

以及解决方案

代码语言:javascript
复制
orbbec.com.cn/sys/37.html

主要是现在有两个大类,一个是完整的开发,一个嵌入到产品,甚至是集成到手机内部。

这里是所有的相机,都是卖1000

上面是Astra相机的几个产品,是一开始开发前的相机

就是做项目的验证时候使用,在投入量产的时候不会用

我大致做了一下思维导图

代码语言:javascript
复制
https://developer.orbbec.com.cn/module.html?id=6

这个页面隐藏的比较深,是后面几个相机的页面图

这个页面和大疆的有点像

我首先选择的是USB3.0的快速接口,这个就过滤了几个相机。

这个精度就蛮好了,不需要3mm的

所以在deeyea和Gemini里面选择

所有的参数,对我的项目可以说是很合适了

外观也好看,还有Type-C的接口

正视图

特别的还使用到了主动的双目结构光方案

我还没有试过这个方案

组装时候的爆炸图

一些特性

代码语言:javascript
复制
https://github.com/orbbec/

各种库,官方的

代码语言:javascript
复制
https://github.com/search?l=Python&q=orbbec&type=Repositories
代码语言:javascript
复制
https://github.com/bensnell/orbbec-astra

一个读取使用的Python库

代码语言:javascript
复制
https://github.com/rlabbe/filterpy
代码语言:javascript
复制
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python/

笔记一角

两个滤波库,因为噪音太大了

代码语言:javascript
复制
https://filterpy.readthedocs.io/en/latest/

卡尔曼的Python实现库

代码语言:javascript
复制
import numpy as np
from openni import openni2
from openni import _openni2
import cv2 as cv
import open3d
import copy
import time


SAVE_POINTCLOUDS = False


def get_rgbd(color_capture, depth_stream, depth_scale=1000, depth_trunc=4, convert_rgb_to_intensity=False):

    # Get color image
    _, color_image = color_capture.read()
    color_image = color_image[:, ::-1, ::-1]

    # Get depth image
    depth_frame = depth_stream.read_frame()
    depth_image = np.frombuffer(depth_frame.get_buffer_as_uint16(), np.uint16)
    depth_image = depth_image.reshape(depth_frame.height, depth_frame.width)
    depth_image = depth_image.astype(np.float32)

    # Create rgbd image from depth and color
    color_image = np.ascontiguousarray(color_image)
    depth_image = np.ascontiguousarray(depth_image)
    rgbd = open3d.geometry.RGBDImage.create_from_color_and_depth(
        open3d.geometry.Image(color_image),
        open3d.geometry.Image(depth_image),
        depth_scale=depth_scale,
        depth_trunc=depth_trunc,
        convert_rgb_to_intensity=convert_rgb_to_intensity
    )

    return rgbd


def main():
    # Init openni
    openni_dir = "../OpenNI_2.3.0.55/Linux/OpenNI-Linux-x64-2.3.0.55/Redist"
    openni2.initialize(openni_dir)

    # Open astra color stream (using opencv)
    color_capture = cv.VideoCapture(2)
    color_capture.set(cv.CAP_PROP_FPS, 5)

    # Open astra depth stream (using openni)
    depth_device = openni2.Device.open_any()
    depth_stream = depth_device.create_depth_stream()
    depth_stream.start()
    depth_stream.set_video_mode(
        _openni2.OniVideoMode(pixelFormat=_openni2.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_1_MM,
                              resolutionX=640,
                              resolutionY=480,
                              fps=5))
    depth_device.set_image_registration_mode(openni2.IMAGE_REGISTRATION_DEPTH_TO_COLOR)

    # Create pointcloud visualizer
    visualizer = open3d.visualization.Visualizer()
    visualizer.create_window("Pointcloud", width=1000, height=700)

    # Camera intrinsics of the astra pro
    astra_camera_intrinsics = open3d.camera.PinholeCameraIntrinsic(
        width=640,
        height=480,
        fx=585,
        fy=585,
        cx=320,
        cy=250)

    # Create initial pointcloud
    pointcloud = open3d.geometry.PointCloud()
    visualizer.add_geometry(pointcloud)

    first = True
    prev_timestamp = 0
    num_stored = 0

    while True:
        rgbd = get_rgbd(color_capture, depth_stream)

        # Convert images to pointcloud
        new_pointcloud = open3d.geometry.PointCloud.create_from_rgbd_image(
            rgbd,
            intrinsic=astra_camera_intrinsics,
        )
        # Flip pointcloud
        new_pointcloud.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
        # Set rendered pointcloud to recorded pointcloud
        pointcloud.points = new_pointcloud.points
        pointcloud.colors = new_pointcloud.colors

        # Save pointcloud each n seconds
        if SAVE_POINTCLOUDS and time.time() > prev_timestamp + 5:
            filename = "pointcloud-%r.pcd" % num_stored
            open3d.io.write_point_cloud(filename, new_pointcloud)
            num_stored += 1
            print("Stored: %s" % filename)
            prev_timestamp = time.time()

        # Reset viewpoint in first frame to look at the scene correctly
        # (e.g. correct bounding box, direction, distance, etc.)
        if first:
            visualizer.reset_view_point(True)
            first = False

        # Update visualizer
        visualizer.update_geometry()
        visualizer.poll_events()
        visualizer.update_renderer()


if __name__ == "__main__":
    main()

使用 Open3D 显示 Astra Pro Orbbec 的点云

文章写了很久了,很多东西都忘了,当笔记的使用了

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-09-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 云深之无迹 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档