minhas informações de contato
Correspondência[email protected]
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
As câmeras de luz estruturada da Mech Mind, especialmente a série Mech-Eye, são câmeras 3D de alta precisão de nível industrial que são amplamente utilizadas em automação industrial, navegação de robôs, inspeção de qualidade e outros campos. A seguir está uma análise detalhada da câmera de luz estruturada Mech Mind:
As câmeras de luz estruturada da Mech Mind, como a Mech-Eye PRO, usam tecnologia de luz estruturada de alta velocidade para fornecer excelente resistência à luz ambiente, mantendo alta precisão e velocidade. Essas câmeras geralmente contêm módulos de algoritmo de visão ricos e podem ser aplicadas a muitos cenários práticos típicos, como carga e descarga de peças de fabricação, posicionamento de alta precisão, montagem, aperto de parafusos e pesquisa acadêmica.
A câmera de luz estruturada da Mech Mind utiliza principalmente o princípio da projeção de luz estruturada. Eles projetam padrões específicos (como luz estruturada gerada por lasers) no objeto que está sendo fotografado, e o contorno e a forma do objeto são capturados pela câmera. Esta tecnologia pode calcular com precisão a posição e a forma de um objeto, analisando a reflexão e a refração da luz no objeto.
As câmeras de luz estruturadas da Mech Mind são amplamente utilizadas em automóveis, aviação, fabricação de moldes, automação industrial e outros campos. No campo automotivo, eles podem obter com rapidez e precisão as informações de formato da superfície da carroceria do carro; no campo da aviação, eles podem obter as informações de formato tridimensional da aeronave, fornecendo suporte de dados precisos para o projeto e fabricação da aeronave; .
As câmeras de luz estruturadas da Mech Mind desempenham um papel importante em áreas como automação industrial e navegação de robôs devido à sua alta precisão, alta velocidade, grande campo de visão, grande profundidade de campo, forte resistência à luz ambiente e estabilidade e confiabilidade. Com o avanço contínuo da tecnologia e a expansão contínua dos cenários de aplicação, espera-se que as câmeras de luz estruturadas da Mech Mind demonstrem seu valor único em mais campos.
Crie um ambiente virtual
Baixe o pacote opencv-python
Baixe o pacote de captura de câmera Mecamander
- pip install MechEyeAPI
- pip install python-opencv
Conectar câmera
- 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
Desconectar câmera
- def DisConnectCamera(self):
- self.camera.disconnect()
- print("Disconnected from the camera successfully.")
Colete imagens 2D e imagens 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 :{}mmn".
- 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: {}mmn".
- # 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 :{}mmn".
- 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: {}mmn".
- # 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)+'rn')
- print('采集亮度图和深度图')
- d2,d3 = MechMindGraber.GrabImages()
-
-
- cv2.imshow('1',d2)
- cv2.waitKey()
- cv2.imshow('1', d3)
- cv2.waitKey()
- print('断开连接')
- MechMindGraber.DisConnectCamera()