MechMind结构光相机 采图SDK python调用

news2025/2/27 9:28:12

测试效果

Mech-Mind结构光相机

Mech Mind(梅卡曼德)的结构光相机,特别是Mech-Eye系列,是工业级的高精度3D相机,广泛应用于工业自动化、机器人导航、质量检测等多个领域。以下是对Mech Mind结构光相机的详细解析:

一、产品概述

Mech Mind的结构光相机,如Mech-Eye PRO,采用了高速结构光技术,能够在保持高精度、高速度的同时,提供优异的抗环境光性能。这些相机通常包含丰富的视觉算法模块,可应用于多个典型实际场景,如制造业工件上下料、高精度定位、装配、螺丝拧紧及学术研究等。

二、工作原理

Mech Mind的结构光相机主要利用了结构光投影的原理。它们将特定图案(如激光产生的结构光)投射到被拍摄物体上,并通过摄像头捕捉到物体的轮廓和形状。这种技术通过分析光线在物体上的反射和折射,能够精确地计算出物体的位置和形状。

三、产品特点

  1. 高精度:Mech Mind的结构光相机能够在短时间内获取高精度的三维模型,对于不同的物体,只需一次拍摄即可获得准确的形状信息。例如,Mech-Eye PRO的Z向单点重复精度可达到0.05mm(在1.0m处)。
  2. 高速度:相机具备快速的数据采集和处理能力,如Mech-Eye PRO的典型采集时间为0.3~0.6秒。
  3. 大视野和大景深:部分型号如Mech-Eye Deep 3D相机,具备大视野和大景深的特点,可适用于多种常见垛型。
  4. 抗环境光性能强:Mech Mind的结构光相机在较强环境光干扰下(如>20000lx)仍能保持优异的成像效果。
  5. 部署灵活:相机适配了国内外大部分主流品牌的机器人,可以实现对已适配机器人的完全运动控制。
  6. 开放易用:相机提供了友好的用户接口和开放的API,方便用户进行二次开发和集成。
  7. 稳定可靠:Mech Mind的结构光相机具备高稳定性和可靠性,如Mech-Eye PRO的平均无故障运行时间(MTBF)≥40000小时。

四、应用领域

Mech Mind的结构光相机被广泛应用于汽车、航空、模具制造、工业自动化等领域。在汽车领域,它们能够快速精确地获取车身表面的形状信息;在航空领域,它们能够获取飞机的三维形状信息,为飞机的设计和制造提供准确的数据支持。

五、总结

Mech Mind的结构光相机以其高精度、高速度、大视野、大景深、强抗环境光性能以及稳定可靠的特点,在工业自动化和机器人导航等领域发挥着重要作用。随着技术的不断进步和应用场景的不断拓展,Mech Mind的结构光相机有望在更多领域展现其独特的价值。

搭建Python开发环境

创建虚拟环境

下载opencv-python包

下载梅卡曼德相机 采图包

pip install MechEyeAPI
pip install python-opencv

步骤解析

连接相机

def ConnectCamera(self):
    camera_infos = Camera.discover_cameras()
    if len(camera_infos) != 1:
        print("相机连接出现异常,检查网线")
        return
    error_status = self.camera.connect(camera_infos[0])
    if not error_status.is_ok():
        show_error(error_status)
        return

断开相机

def DisConnectCamera(self):
    self.camera.disconnect()
    print("Disconnected from the camera successfully.")

采集2d图和3d图

def connect_and_capture(self):

    # Obtain the 2D image resolution and the depth map resolution of the camera.
    resolution = CameraResolutions()
    show_error(self.camera.get_camera_resolutions(resolution))
    print_camera_resolution(resolution)

    time1 = time.time()
    # Obtain the 2D image.
    frame2d = Frame2D()
    show_error(self.camera.capture_2d(frame2d))
    row, col = 222, 222
    color_map = frame2d.get_color_image()
    print("The size of the 2D image is {} (width) * {} (height).".format(
        color_map.width(), color_map.height()))
    rgb = color_map[row * color_map.width() + col]
    print("The RGB values of the pixel at ({},{}) is R:{},G:{},B{}\n".
          format(row, col, rgb.b, rgb.g, rgb.r))

    Image2d = color_map.data()

    time2 = time.time()
    print('grab 2d image : '+str((time2-time1)*1000)+'ms')


    # if not confirm_capture_3d():
    #     return

    # Obtain the depth map.
    frame3d = Frame3D()
    show_error(self.camera.capture_3d(frame3d))
    depth_map = frame3d.get_depth_map()
    print("The size of the depth map is {} (width) * {} (height).".format(
        depth_map.width(), depth_map.height()))
    depth = depth_map[row * depth_map.width() + col]
    print("The depth value of the pixel at ({},{}) is depth :{}mm\n".
          format(row, col, depth.z))
    Image3d = depth_map.data()
    time3 = time.time()
    print('grab depth image : '+str((time3-time2)*1000)+'ms')


    return Image2d,Image3d
    # Obtain the point cloud.
    # point_cloud = frame3d.get_untextured_point_cloud()
    # print("The size of the point cloud is {} (width) * {} (height).".format(
    #     point_cloud.width(), point_cloud.height()))
    # point_xyz = point_cloud[row * depth_map.width() + col]
    # print("The coordinates of the point corresponding to the pixel at ({},{}) is X: {}mm , Y: {}mm, Z: {}mm\n".
    #       format(row, col, point_xyz.x, point_xyz.y, point_xyz.z))

完整测试代码

# With this sample, you can connect to a camera and obtain the 2D image, depth map, and point cloud data.
import time

from mecheye.shared import *
from mecheye.area_scan_3d_camera import *
from mecheye.area_scan_3d_camera_utils import *
import cv2


class ConnectAndCaptureImages(object):
    def __init__(self):
        self.camera = Camera()

    def connect_and_capture(self):

        # Obtain the 2D image resolution and the depth map resolution of the camera.
        resolution = CameraResolutions()
        show_error(self.camera.get_camera_resolutions(resolution))
        print_camera_resolution(resolution)

        time1 = time.time()
        # Obtain the 2D image.
        frame2d = Frame2D()
        show_error(self.camera.capture_2d(frame2d))
        row, col = 222, 222
        color_map = frame2d.get_color_image()
        print("The size of the 2D image is {} (width) * {} (height).".format(
            color_map.width(), color_map.height()))
        rgb = color_map[row * color_map.width() + col]
        print("The RGB values of the pixel at ({},{}) is R:{},G:{},B{}\n".
              format(row, col, rgb.b, rgb.g, rgb.r))

        Image2d = color_map.data()

        time2 = time.time()
        print('grab 2d image : '+str((time2-time1)*1000)+'ms')


        # if not confirm_capture_3d():
        #     return

        # Obtain the depth map.
        frame3d = Frame3D()
        show_error(self.camera.capture_3d(frame3d))
        depth_map = frame3d.get_depth_map()
        print("The size of the depth map is {} (width) * {} (height).".format(
            depth_map.width(), depth_map.height()))
        depth = depth_map[row * depth_map.width() + col]
        print("The depth value of the pixel at ({},{}) is depth :{}mm\n".
              format(row, col, depth.z))
        Image3d = depth_map.data()
        time3 = time.time()
        print('grab depth image : '+str((time3-time2)*1000)+'ms')


        return Image2d,Image3d
        # Obtain the point cloud.
        # point_cloud = frame3d.get_untextured_point_cloud()
        # print("The size of the point cloud is {} (width) * {} (height).".format(
        #     point_cloud.width(), point_cloud.height()))
        # point_xyz = point_cloud[row * depth_map.width() + col]
        # print("The coordinates of the point corresponding to the pixel at ({},{}) is X: {}mm , Y: {}mm, Z: {}mm\n".
        #       format(row, col, point_xyz.x, point_xyz.y, point_xyz.z))

    def main(self):
        # List all available cameras and connect to a camera by the displayed index.
        if find_and_connect(self.camera):
            d2,d3 = self.connect_and_capture()
            self.camera.disconnect()
            print("Disconnected from the camera successfully.")
        return d2,d3

    def GrabImages(self):
        d2, d3 = self.connect_and_capture()
        return d2, d3

    def ConnectCamera(self):
        camera_infos = Camera.discover_cameras()
        if len(camera_infos) != 1:
            print("相机连接出现异常,检查网线")
            return
        error_status = self.camera.connect(camera_infos[0])
        if not error_status.is_ok():
            show_error(error_status)
            return
    def DisConnectCamera(self):
        self.camera.disconnect()
        print("Disconnected from the camera successfully.")





if __name__ == '__main__':

    #pip install MechEyeAPI

    print('初始化相机对象')
    MechMindGraber = ConnectAndCaptureImages()
    # d2,d3 = a.main()
    print('连接相机')
    MechMindGraber.ConnectCamera()

    for i in range(60):
        print(str(i)+'\r\n')
        print('采集亮度图和深度图')
        d2,d3  = MechMindGraber.GrabImages()


    cv2.imshow('1',d2)
    cv2.waitKey()
    cv2.imshow('1', d3)
    cv2.waitKey()
    print('断开连接')
    MechMindGraber.DisConnectCamera()

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1918254.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

阿里巴巴国际站携手NBA传奇托尼·帕克,中国卖家又一波利好!

在全球化浪潮日益汹涌的今天,跨界合作已成为推动品牌国际化进程的重要力量。近日,阿里巴巴国际站宣布了一项震撼业界的合作——正式签约NBA(美国职业篮球联赛)传奇控球后卫托尼帕克(Tony Parker)作为其全球…

2024年10款免费的项目管理软件推荐

本文向大家推荐10款2024年免费使用的项目管理软件,其中包括桌面应用和基于Web平台的多种产品,同时还涵盖了一些优秀的开源软件。 1.禅道开源项目管理软件 禅道是一款开源的、基于Web的项目管理软件,其功能丰富且操作简便,为团队提…

生产管理系统功能全拆解:哪些功能是企业真正需要的?

制造业的伙伴经常听到“生产管理”,但很多人可能只是模糊地知道它与工厂、生产线有关。那么,到底什么是生产管理呢?它的重要性又体现在哪里呢?接下来,我就以轻松的方式,带大家走进生产管理的世界&#xff0…

笔记:Qt开发之工程的多模块设计(pri)

目标:对于功能模块较多的Qt项目,使用pri文件管理模块文件,降低工程复杂度,提高软件模块的封装性和重用性。 一、知识储备 1.1 pro与pri文件 对于模块化编程,Qt提供了pro和pri,pro管理项目,pri…

算法 —— 模拟

目录 替换所有的问号 提莫攻击 Z字形变换 外观数列 各位读者有听说过“建模”一词吗?所谓“建模”,就是把事物进行抽象,根据实际问题来建立对应的数学模型。“抽象”并不意味着晦涩难懂;相反,它提供了大量的便利。…

新兴商业模式如何破局?市场策划专家的实战指南

在这个融合了传统市场、互联网和信息技术的大潮中,想要在市场营销策划上玩得转,咱们得有超凡的全局思维和跨界的协作精神。 下面,我就来和大家聊聊如何在这样一个复杂环境下搞定市场营销策划,让你在竞争激烈的市场中脱颖而出。 …

Ubuntu编译PX4固件

目录 前言 准备编译参考 前言 要想自己编译PX4固件需要交叉编译器,交叉编译器可以将 x86架构 平台上写好程序编译出来,而编译出来的可执行文件是能用到 arm架构 的平台上。 本次编译是以 px4 v1.13.2 为例。 我的配置如下: 虚拟机 Ubuntu 18…

微气象仪的工作原理

型号推荐:云境天合TH-WQX5】风力发电传感器在风力发电系统中起着至关重要的作用,它们能够实时监测和记录各种关键参数,为风力发电机组的控制提供数据支持,从而确保风力发电系统的安全、高效运行。以下是对风力发电传感器的详细解析…

喜讯|华院计算法律大模型入围《2024大模型典型示范应用案例集》

2024年世界人工智能大会(WAIC)举办期间,中国信通院正式发布了《2024大模型典型示范应用案例集》(以下简称《案例集》)。该案例集由中国信通院华东分院、上海人工智能实验室主导,以产业化为导向,…

Vue从零到实战第一天

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 非常期待和您一起在这个小…

免费分享:中国冬小麦地图数据集(附下载方法)

小麦按播种和收获季节的不同,可分为春小麦和冬小麦两种。春小麦颗粒长而大,皮厚色泽深,蛋白质含量高,但筋力较差,出粉率低,吸水率高;冬小麦颗粒小,吸水率低,蛋白质含量较春小麦少&am…

element-plus 按需导入问题 404等问题

场景 新开一个项目,需要用element-plus这个ui库,使用按需引入。 这是我项目的一些版本号 "element-plus": "^2.7.6","vue": "^3.2.13","vue-router": "^4.0.3",过程(看解决方法…

电商、物流必备神器!容联七陌OCR精准识别、一键复制关键信息!

随着大模型、AI技术的快速发展及落地运用,传统的数据处理方式难以满足企业、行业需求,例如一字一句输入效率低、文字复制方式繁琐且容易出错、截图关键信息提取的准确性和高效性、缺乏信息智能识别能力等。 OCR识别技术能够快速准确地将图片中的文字信息…

【Linux】进程的基本概念(以及进程地址空间的初步了解)

目录 一.什么是进程 进程和程序的区别 Linux查看进程 进程的信息 fork函数 二.进程状态 操作系统上进程状态的概念 运行 阻塞 挂起 Linux中的进程状态 R状态 S状态和D状态 T状态 t状态 X状态 Z状态 三.进程的优先级 修改进程优先级 四.环境变量 常见的环境变量 PATH HOME PW…

行列视(RCV)报表是如何产生的?

首先看一下对于生产型企业来说,生产数据特点是什么样的: 生产数据可以理解为是生产制造企业,在生产过程中从车间现场设备上通过自动化传感器采集到的全面感知数据。这类数据一般包括设备状态、设备管道运行参数、各种仪表参数等。具有持续、…

【Linux操作系统-测试】第三节.Linux 系统、网络信息、用户权限命令总结

文章目录 前言一、Linux 系统相关信息命令 1.1 df 命令--查看磁盘剩余 1.2 ps 命令--查看进程 1.3 top 命令--显示进程运行状态 1.4 kill 命令说明 -- 杀死进程二、Linux 网络信息命令 2.1 ping 命令--检查网络是否连通 2.1 ifconfig--显示网络设…

便携式(手持)气象仪:野外气象监测的得力助手

在气象监测领域,随着科技的不断发展,一种新型的便携式(手持)气象仪正在逐渐崭露头角。便携式(手持)气象仪以其高度集成、低功耗、可快速安装以及便于野外使用的特性,成为了气象观测领域的一颗新…

微信小程序切换商户号

1.登录微信公众平台小程序 2.功能->微信支付 3.关联成功后会志一关联商户号列表显示 4.登录你需要切换的商户号 在下面选择你需要开通的产品服务 5.切换到账户中心的api安全里面 只需要改变当前下面的配置即可切换小程序的收款商户号 申请API证书按照官方的指引即可解…

Redis+Caffeine 实现两级缓存实战

RedisCaffeine 实现两级缓存 背景 ​ 事情的开始是这样的,前段时间接了个需求,给公司的商城官网提供一个查询预计送达时间的接口。接口很简单,根据请求传的城市仓库发货时间查询快递的预计送达时间。因为商城下单就会调用这个接口&#xff…

如何将一个2D数组切分成多个块

要将一个2D数组切分成多个块,可以考虑使用以下几种方法,具体取决于如何定义块的划分规则和需求。如果你希望将2D数组均匀地切分成固定大小的小块,可以使用简单的循环和切片操作。 1、问题背景 Python 中, 如果有一个 raw 数据文件&#xff0…