Guide de migration de la version 2.1.0 vers la version 2.2.0

Vous consultez actuellement la documentation pour la dernière version (2.5.4). Pour accéder à une autre version, cliquez sur le bouton "Changer de version" situé dans le coin supérieur droit de la page.

■ Si vous n’êtes pas sûr de la version du produit que vous utilisez, veuillez contacter le support technique Mech-Mind pour obtenir de l’aide.

Mech-Eye API 2.2.0 a été restructuré afin d’offrir une structure plus claire tout en conservant toutes les fonctions auparavant disponibles. De nouvelles fonctions ont également été ajoutées.

Ce sujet répertorie les principaux changements de Mech-Eye API 2.2.0 par rapport à Mech-Eye API 2.1.0. Si vous souhaitez utiliser la version 2.2.0 de Mech-Eye API dans votre programme client existant, vous pouvez vous référer à ce sujet et modifier votre programme client.

Importer des modules

Dans Mech-Eye API 2.2.0, les modifications suivantes ont été apportées à l’instruction d’importation des modules :

2.1.0 2.2.0
  • C++

  • C#

  • Python

#include "MechEyeApi.h"

using namespace mmind::api;
using mmind.apiSharp;
from MechEye import Device
  • C++

  • C#

  • Python

#include "Camera.h"

using namespace mmind::eye;
using MMind.Eye;
from mecheye.shared import *
from mecheye.area_scan_3d_camera import *
from mecheye.area_scan_3d_camera_utils import *

Créer un objet caméra

Dans Mech-Eye API 2.2.0, les modifications suivantes ont été apportées à l’instruction de création d’un objet représentant les caméras :

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::MechEyeDevice device;
var device = new MechEyeDevice();
device = Device()
  • C++

  • C#

  • Python

mmind::eye::Camera camera;
var camera = new Camera();
camera = Camera()

Découvrir et se connecter à la caméra

Dans Mech-Eye API 2.2.0, les modifications suivantes ont été apportées aux instructions de découverte et de connexion à une caméra :

2.1.0 2.2.0
  • C++

  • C#

  • Python

std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList = mmind::api::MechEyeDevice::enumerateMechEyeDeviceList();

mmind::api::MechEyeDevice device;
device.connect(deviceInfoList[0]);
var deviceInfoList = MechEyeDevice.EnumerateMechEyeDeviceList();

var device = new MechEyeDevice();
device.Connect(deviceInfoList[0]);
device_list = Device.get_device_list()

device = Device()
device.connect(device_list[0])
  • C++

  • C#

  • Python

std::vector<mmind::eye::CameraInfo> cameraInfoList = mmind::eye::Camera::discoverCameras();

mmind::eye::Camera camera;
camera.connect(cameraInfoList[0]);
var cameraInfoList = Camera.DiscoverCameras();

var camera = new Camera();
camera.Connect(cameraInfoList[0]);
camera_infos = Camera.discover_cameras()

camera = Camera()
camera.connect(camera_infos[0])

Gérer les groupes de paramètres

Mech-Eye API 2.2.0 utilise des classes pour organiser les fonctions liées aux groupes de paramètres et aux paramètres. Pour plus de détails, veuillez vous référer à Hiérarchie fonctionnelle des classes. Les changements des fonctions fréquemment utilisées sont listés ici.

2.1.0 2.2.0
  • C++

  • C#

  • Python

std::vector<std::string> userSets;
device.getAllUserSets(userSets);

std::string currentUserSetName;
device.getCurrentUserSet(currentUserSet);

device.setCurrentUserSet(userSets.front());

device.addUserSet("NewSetting");

device.saveAllSettingsToUserSets();
var userSets = new List<string>();
device.GetAllUserSets(ref userSets);

std::string currentUserSetName = "";
device.GetCurrentUserSet(ref currentUserSetName);

device.SetCurrentUserSet(userSets[0])

device.AddUserSet("NewSetting");

device.SaveAllSettingsToUserSets();
# Obtain the names of all parameter groups.
user_sets = device.get_all_user_sets()

# Get the name of the current parameter group.
current_user_set = device.get_current_user_set()

# Select a parameter group.
device.set_current_user_set(user_sets[0])

# Add a parameter group.
device.add_user_set("NewSetting")

# Save the current parameter settings to the parameter group.
device.save_all_settings_to_user_set()
  • C++

  • C#

  • Python

std::vector<std::string> userSets;
mmind::eye::UserSetManager& userSetManager = camera.userSetManager();
userSetManager.getAllUserSetNames(userSets);

mmind::eye::UserSet& curSettings = userSetManager.currentUserSet();
std::string currentName;
curSettings.getName(currentName);

userSetManager.selectUserSet(userSets.front());

userSetManager.addUserSet("NewSetting");

camera.currentUserSet().saveAllParametersToDevice();
var userSetManager = camera.UserSetManager();
var userSets = new List<string>();
userSetManager.GetAllUserSetNames(ref userSets);

var currentName = userSetManager.CurrentUserSet().GetName();

userSetManager.SelectUserSet(userSets[0]);

userSetManager.AddUserSet("NewSetting");

camera.CurrentUserSet().SaveAllParametersToDevice();
# Obtain the names of all parameter groups.
user_set_manager = camera.userSetManager()
error, user_sets = user_set_manager.get_all_user_set_names()

# Get the name of the current parameter group.
current_user_set = user_set_manager.current_user_set().get_name()

# Select a parameter group.
user_set_manager.select_user_set(user_sets[0])

# Add a parameter group.
user_set_manager.add_user_set("NewSetting")

# Save the current parameter settings to the parameter group.
camera.current_user_set().save_all_parameters_to_device()

Définir et obtenir les valeurs des paramètres

Mech-Eye API 2.2.0 utilise des classes pour organiser les fonctions liées aux groupes de paramètres et aux paramètres. Pour plus de détails, veuillez vous référer à Hiérarchie fonctionnelle des classes.

Par ailleurs, Mech-Eye API 2.2.0 fournit des méthodes pour définir et obtenir des paramètres en fonction des types de données des paramètres.

Les types de données de paramètres suivants sont distingués dans Mech-Eye API 2.2.0 :

  • _Int

  • _Float

  • _Bool

  • _Enum

  • _Roi

  • _Range

  • _FloatArray

The following sections provide examples of each data type.

_Int Type

Le paramètre Seuil de contraste des franges dans la catégorie Traitement du nuage de points est utilisé comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setFringeContrastThreshold(15);

int fringeContrastThreshold = 0;
device.getFringeContrastThreshold(fringeContrastThreshold);
device.SetFringeContrastThreshold(15);

var fringeContrastThreshold = new int();
device.GetFringeContrastThreshold(ref fringeContrastThreshold);
device.set_fringe_contrast_threshold(15)

fringe_contrast_threshold = device.get_fringe_contrast_threshold()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/PointCloudProcessing.h"

camera.currentUserSet().setIntValue(mmind::eye::pointcloud_processing_setting::FringeContrastThreshold::name, 15);

int fringeContrastThreshold = 0;
camera.currentUserSet().getIntValue(mmind::eye::pointcloud_processing_setting::FringeContrastThreshold::name, fringeContrastThreshold);
camera.CurrentUserSet().SetIntValue(MMind.Eye.PointCloudProcessingSetting.FringeContrastThreshold.Name, 15);

var fringeContrastThreshold = new int();
camera.CurrentUserSet().GetIntValue(MMind.Eye.PointCloudProcessingSetting.FringeContrastThreshold.Name, ref fringeContrastThreshold);
camera.current_user_set().set_int_value(PointCloudFringeContrastThreshold.name, 15)

error, fringe_contrast_threshold = camera.current_user_set().get_int_value(PointCloudFringeContrastThreshold.name)

_Float Type

Le paramètre Temps d’exposition dans la catégorie Paramètres 2D est utilisé comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setScan2DExposureTime(100);

double scan2DExposureTime = 0;
device.getScan2DExposureTime(scan2DExposureTime);
device.setScan2DExposureTime(100);

var scan2DExposureTime = new double();
device.GetScan2DExposureTime(ref scan2DExposureTime);
device.set_scan_2d_exposure_time(100)

scan_2d_exposure_time = device.get_scan_2d_exposure_time()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/Scanning2D.h"

camera.currentUserSet().setFloatValue(mmind::eye::scanning2d_setting::ExposureTime::name, 100);

double scan2DExposureTime = 0;
camera.currentUserSet().getFloatValue(mmind::eye::scanning2d_setting::ExposureTime::name, scan2DExposureTime);
camera.CurrentUserSet().SetFloatValue(MMind.Eye.Scanning2DSetting.ExposureTime.Name, true);

var scan2DExposureTime = new double();
camera.CurrentUserSet().GetFloatValue(MMind.Eye.Scanning2DSetting.ExposureTime.Name, ref scan2DExposureTime);
camera.current_user_set().set_float_value(Scanning2DExposureTime.name, 100)

error, scan_2d_exposure_time = camera.current_user_set().get_float_value(Scanning2DExposureTime.name)

_Bool Type

Le paramètre Mappage de tonalité dans la catégorie Paramètres 2D est utilisé comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setScan2DToneMappingEnable(true);

bool toneMappingEnable = false;
device.getScan2DToneMappingEnable(toneMappingEnable);
device.SetScan2DToneMappingEnable(true);

var toneMappingEnable = new bool();
device.GetScan2DToneMappingEnable(ref toneMappingEnable);
device.set_scan_2d_tone_mapping_enable(True)

tone_mapping_enable = device.get_scan_2d_tone_mapping_enable()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/Scanning2D.h"

camera.currentUserSet().setBoolValue(mmind::eye::scanning2d_setting::ToneMappingEnable::name, true);

bool toneMappingEnable = false;
camera.currentUserSet().getBoolValue(mmind::eye::scanning2d_setting::ToneMappingEnable::name, toneMappingEnable);
camera.CurrentUserSet().SetBoolValue(MMind.Eye.Scanning2DSetting.ToneMappingEnable.Name, true);

var toneMappingEnable = new bool();
camera.CurrentUserSet().GetBoolValue(MMind.Eye.Scanning2DSetting.ToneMappingEnable.Name, ref toneMappingEnable);
camera.current_user_set().set_bool_value(Scanning2DToneMappingEnable.name, True)

error, tone_mapping_enable = camera.current_user_set().get_bool_value(Scanning2DToneMappingEnable.name)

_Enum Type

Le paramètre Lissage de la surface dans la catégorie Traitement du nuage de points est utilisé comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setCloudSurfaceSmoothingMode(mmind::api::PointCloudProcessingSettings::PointCloudSurfaceSmoothing::Normal);

mmind::api::PointCloudProcessingSettings::PointCloudSurfaceSmoothing surfaceSmoothing;
device.getCloudSurfaceSmoothingMode(surfaceSmoothing);
device.SetCloudSurfaceSmoothingMode(PointCloudSurfaceSmoothing.Normal);

var surfaceSmoothingMode = new PointCloudSurfaceSmoothing();
device.GetCloudSurfaceSmoothingMode(ref surfaceSmoothingMode);
device.set_cloud_surface_smoothing_mode("Normal")
cloud_surface_smoothing_mode = device.get_cloud_surface_smoothing_mode()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/PointCloudProcessing.h"

camera.currentUserSet().setEnumValue(mmind::eye::pointcloud_processing_setting::SurfaceSmoothing::name,
        static_cast<int>(mmind::eye::pointcloud_processing_setting::SurfaceSmoothing::Value::Normal));

int surfaceSmoothing = 0;
camera.currentUserSet().currentUserSet.getEnumValue(mmind::eye::pointcloud_processing_setting::SurfaceSmoothing::name, surfaceSmoothing);
camera.currentUserSet().SetEnumValue(MMind.Eye.PointCloudProcessingSetting.SurfaceSmoothing.Name, (int)MMind.Eye.PointCloudProcessingSetting.SurfaceSmoothing.Value.Normal);

var surfaceSmoothingMode = new int();
camera.currentUserSet().GetEnumValue(MMind.Eye.PointCloudProcessingSetting.SurfaceSmoothing.Name, ref surfaceSmoothingMode);
camera.current_user_set().set_enum_value(PointCloudSurfaceSmoothing.name, PointCloudSurfaceSmoothing.Value_Normal)
error, cloud_surface_smoothing_mode = camera.current_user_set().get_enum_value(PointCloudSurfaceSmoothing.name)

_Roi Type

Le paramètre ROI est utilisé comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setScan3DROI(mmind::api::ROI(0, 0, 500, 500));

mmind::api::ROI roi;
device.getScan3DROI(roi);
device.SetScan3DROI(new ROI(0, 0, 500, 500));

var roi = new ROI();
device.GetScan3DROI(ref roi);
device.set_scan_3d_roi(0, 0, 500, 500)

roi = device.get_scan_3d_roi()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/Scanning3D.h"

camera.currentUserSet().setRoiValue(mmind::eye::scanning3d_setting::ROI::name, mmind::eye::ROI(0, 0, 500, 500));

mmind::eye::ROI roi;
camera.currentUserSet().getRoiValue(mmind::eye::scanning3d_setting::ROI::name, roi);
camera.CurrentUserSet().SetRoiValue(MMind.Eye.Scanning3DSetting.ROI.Name, new ROI(0, 0, 500, 500));

var roi = new ROI();
camera.CurrentUserSet().GetRoiValue(MMind.Eye.Scanning3DSetting.ROI.Name, ref roi);
camera.current_user_set().set_roi_value(Scanning3DROI.name, ROI(0, 0, 500, 500))

error, roi = camera.current_user_set().get_roi_value(Scanning3DROI.name)

_Range Type

Le paramètre Plage de profondeur est utilisé comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setDepthRange(mmind::api::DepthRange(100, 2000));

mmind::api::DepthRange depthRange;
device.getDepthRange(depthRange);
device.SetDepthRange(new DepthRange(100, 2000));

val depthRange = new DepthRange();
device.GetDepthRange(ref depthRange);
device.set_depth_range(100, 2000)

depth_range = device.get_depth_range()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/Scanning3D.h"

camera.currentUserSet().setRangeValue(mmind::eye::scanning3d_setting::DepthRange::name, mmind::eye::Range<int>{100, 2000});

mmind::eye::Range<int> rangeValue;
camera.currentUserSet().getRangeValue(mmind::eye::scanning3d_setting::DepthRange::name, rangeValue);
camera.CurrentUserSet().SetRangeValue(MMind.Eye.Scanning3DSetting.DepthRange.Name, new IntRange(100, 2000));

var range = new IntRange();
camera.CurrentUserSet().GetRangeValue(MMind.Eye.Scanning3DSetting.DepthRange.Name, ref range);
camera.current_user_set().set_range_value(Scanning3DDepthRange.name, RangeInt(100, 1000))

error, range = camera.current_user_set().get_range_value(Scanning3DDepthRange.name)

_FloatArray Type

Les paramètres Temps d’exposition dans la catégorie Paramètres 3D sont utilisés comme exemple.

2.1.0 2.2.0
  • C++

  • C#

  • Python

device.setScan3DExposure(std::vector<double>{5, 10});

std::vector<double> exposureSequence;
device.getScan3DExposure(exposureSequence);
device.SetScan3DExposure(new List<double> { 5, 10 });

var exposureSequence = new List<double>();
device.GetScan3DExposure(ref exposureSequence);
device.set_scan_3d_exposure([5.0, 10.0])

exposure_sequence = device.get_scan_3d_exposure()
  • C++

  • C#

  • Python

#include "area_scan_3d_camera/parameters/Scanning3D.h"

camera.currentUserSet().setFloatArrayValue(mmind::eye::scanning3d_setting::ExposureSequence::name, std::vector<double>{5, 10});

std::vector<double> exposureSequence;
camera.currentUserSet().getFloatArrayValue(mmind::eye::scanning3d_setting::ExposureSequence::name, exposureSequence);
camera.CurrentUserSet().SetFloatArrayValue(MMind.Eye.Scanning3DSetting.ExposureSequence.Name, new List<double> { 5, 10 });

var exposureSequence = new List<double>();
camera.CurrentUserSet().GetFloatArrayValue(MMind.Eye.Scanning3DSetting.ExposureSequence.Name, ref exposureSequence);
camera.current_user_set().set_float_array_value(Scanning3DExposureSequence.name, [5, 10])

error, exposure_sequence = camera.current_user_set().get_float_array_value(Scanning3DExposureSequence.name)

Acquérir des données

Dans Mech-Eye API 2.2.0, les modifications suivantes ont été apportées aux instructions d’acquisition de données :

Acquérir une image 2D

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::ColorMap color;
device.captureColorMap(color);
var color = new ColorMap();
device.CaptureColorMap(ref color);
color_map = device.capture_color()
  • C++

  • C#

  • Python

mmind::eye::Frame2D frame2D;
camera.capture2D(frame2D);
mmind::eye::Color2DImage color = frame3D.getColorImage();
var frame = new Frame2D();
camera.Capture2D(ref frame);
var color = frame.GetColorImage();
frame_2d = Frame2D()
camera.capture_2d(frame_2d)
color = frame.get_color_image()

Acquérir une carte de profondeur

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::DepthMap depth;
device.captureDepthMap(depth);
var depth = new DepthMap();
device.CaptureDepthMap(ref depth);
depth_map = device.capture_depth()
  • C++

  • C#

  • Python

mmind::eye::Frame3D frame3D;
camera.capture3D(frame3D);
mmind::eye::DepthMap depth = frame3D.getDepthMap();
var frame = new Frame3D();
camera.Capture3D(ref frame);
var depth = frame.GetDepthMap();
frame_3d = Frame3D()
camera.capture_3d(frame_3d)
depth = frame_3d.get_depth_map()

Acquérir un nuage de points non texturé

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::PointXYZMap pointXYZMap;
device.capturePointXYZMap(pointXYZMap);
var pointXYZMap = new PointXYZMap();
device.CapturePointXYZMap(ref pointXYZMap);
points_xyz = device.capture_point_xyz()
  • C++

  • C#

  • Python

mmind::eye::Frame3D frame3D;
camera.capture3D(frame3D);
mmind::eye::PointCloud cloud = frame3D.getUntexturedPointCloud();
var frame = new Frame3D();
camera.Capture3D(ref frame);
var cloud = frame.GetUntexturedPointCloud();
frame_3d = Frame3D()
camera.capture_3d(frame_3d)
cloud = frame_3d.get_untextured_point_cloud()

Acquérir un nuage de points texturé

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::PointXYZBGRMap pointXYZBGRMap;
device.capturePointXYZBGRMap(pointXYZBGRMap);
var pointXYZBGRMap = new PointXYZBGRMap();
device.CapturePointXYZBGRMap(ref pointXYZBGRMap)
points_xyz_bgr = device.capture_point_xyz_bgr()
  • C++

  • C#

  • Python

mmind::eye::Frame2DAnd3D frame2DAnd3D;
camera.capture2DAnd3D(frame2DAnd3D);
mmind::eye::TexturedPointCloud cloud = frame2DAnd3D.getTexturedPointCloud();
var frame = new Frame2DAnd3D();
camera.Capture2DAnd3D(ref frame);
var cloud = frame.GetTexturedPointCloud();
frame = Frame2DAnd3D()
camera.capture_2d_and_3d(frame)
cloud = frame.get_textured_point_cloud()

Obtenir les informations et les propriétés de la caméra

Mech-Eye API 2.2.0 utilise des classes pour organiser les informations et les propriétés de la caméra. Pour plus de détails, veuillez vous référer à Hiérarchie fonctionnelle des classes.

Obtenir les informations de la caméra

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::MechEyeDeviceInfo deviceInfo;
device.getDeviceInfo(deviceInfo);

std::string model = deviceInfo.model;
std::string serialNumber = deviceInfo.id;
std::string firmwareVersion = deviceInfo.firmwareVersion;
var deviceInfo = new MechEyeDeviceInfo();
device.GetDeviceInfo(ref deviceInfo);

var model = deviceInfo.model;
var serialNumber = deviceInfo.id;
var firmwareVersion = deviceInfo.firmwareVersion;
device_info = device.get_device_info()
  • C++

  • C#

  • Python

mmind::eye::CameraInfo cameraInfo;
camera.getCameraInfo(cameraInfo);

std::string model = cameraInfo.model;
std::string serialNumber = cameraInfo.serialNumber;
std::string firmwareVersion = cameraInfo.firmwareVersion.toString();
var cameraInfo = new CameraInfo();
camera.GetCameraInfo(ref cameraInfo);

var model = cameraInfo.Model;
var serialNumber = cameraInfo.SerialNumber;
var firmwareVersion = cameraInfo.FirmwareVersion.ToString();
camera_info = CameraInfo()
camera.get_camera_info(camera_info)

Obtenir les températures de la caméra

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::DeviceTemperature devicetemperature;
device.getDeviceTemperature(devicetemperature);

float cpu = devicetemperature.cpuTemperature;
float projector = devicetemperature.projectorModuleTemperature;
var temperature = new DeviceTemperature();
device.GetDeviceTemperature(ref temperature);

var cpu = temperature.cpu;
var projector = temperature.projectorModule;
device_temperature = device.get_device_temperature()

cpu = device_temperature.cpu_temperature()
projector = device_temperature.projector_module_temperature()
  • C++

  • C#

  • Python

mmind::eye::CameraStatus cameraStatus;
camera.getCameraStatus(cameraStatus);

float cpu = cameraStatus.temperature.cpuTemperature;
float projector = cameraStatus.temperature.projectorTemperature;
var cameraStatus = new CameraStatus();
camera.GetCameraStatus(ref cameraStatus);

var cpu = cameraStatus.Temperature.CpuTemperature;
var projector = cameraStatus.Temperature.ProjectorModuleTemperature;
camera_status = CameraStatus()
camera.get_camera_status(camera_status)

cpu = camera_status.temperature.cpu_temperature
projector = camera_status.temperature.projector_module_temperature

Obtenir les résolutions d’image

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::DeviceResolution deviceResolution;
device.getDeviceResolution(deviceResolution);

unsigned int textureWidth = deviceResolution.colorMapWidth;
unsigned int textureHeight = deviceResolution.colorMapHeight;
unsigned int depthWidth = deviceResolution.depthMapWidth;
unsigned int depthHeight = deviceResolution.depthMapHeight;
var deviceResolution = new DeviceResolution();
device.GetDeviceResolution(ref deviceResolution);

var textureWidth = deviceResolution.colorMapWidth;
var textureHeight = deviceResolution.colorMapHeight;
var depthWidth = deviceResolution.depthMapWidth;
var depthHeight = deviceResolution.depthMapHeight;
device_resolution = device.get_device_resolution()

texture_width = device_resolution.color_width()
texture_height = device_resolution.color_height()
depth_width = device_resoution.depth_width()
depth_height = device_resolution.depth_height()
  • C++

  • C#

  • Python

mmind::eye::CameraResolutions cameraResolutions;
camera.getCameraResolutions(cameraResolutions);

unsigned int textureWidth = cameraResolutions.texture.width;
unsigned int textureHeight = cameraResolutions.texture.height;
unsigned int depthWidth = cameraResolutions.depth.width;
unsigned int depthHeight = cameraResolutions.depth.height;
var cameraResolutions = new CameraResolutions();
camera.GetCameraResolutions(ref cameraResolutions);

var textureWidth = cameraResolutions.Texture.Width;
var textureHeight = cameraResolutions.Texture.Height;
var depthWidth = cameraResolutions.Depth.Width;
var depthHeight = cameraResolutions.Depth.Height;
camera_resolutions = CameraResolutions()
camera.get_camera_resolutions(camera_resolutions)

texture_width = camera_resolutions.texture.width
texture_height = camera_resolutions.texture.height
depth_width = camera_resolutions.depth.width
depth_height = camera_resolutions.depth.height

Obtenir les paramètres intrinsèques de la caméra

2.1.0 2.2.0
  • C++

  • C#

  • Python

mmind::api::DeviceIntri deviceIntri;
device.getDeviceIntri(deviceIntri);

const mmind::eye::CameraIntri textureIntri = deviceIntri.textureCameraIntri;

const double fx = textureIntri.cameraMatrix[0];
const double fy = textureIntri.cameraMatrix[1];
const double cx = textureIntri.cameraMatrix[2];
const double cy = textureIntri.cameraMatrix[3];

const double k1 = textureIntri.distortion[0];
const double k2 = textureIntri.distortion[1];
const double p1 = textureIntri.distortion[2];
const double p2 = textureIntri.distortion[3];
const double k3 = textureIntri.distortion[4];
var deviceIntri = new DeviceIntri();
device.GetDeviceIntri(ref deviceIntri);

var textureCameraIntri = deviceIntri.textureCameraIntri;

const double fx = textureCameraIntri.fx;
const double fy = textureCameraIntri.fy;
const double cx = textureCameraIntri.cx;
const double cy = textureCameraIntri.cy;

const double k1 = textureCameraIntri.k1;
const double k2 = textureCameraIntri.k2;
const double p1 = textureCameraIntri.p1;
const double p2 = textureCameraIntri.p2;
const double k3 = textureCameraIntri.k3;
device_intri = device.get_device_intrinsic()

texture_intri = device_intri.texture_camera_intrinsic()

fx = texture_intri.camera_matrix_fx()
fy = textrue_intri.camera_matrix_fy()
cx = texture_intri.camera_matrix_cx()
cy = texture_intri.camera_matrix_cy()

k1 = texture_intri.dist_coeffs_k1()
k2 = texture_intri.dist_coeffs_k2()
p1 = texture_intri.dist_coeffs_p1()
p2 = texture_intri.dist_coeffs_p2()
k3 = texture_intri.dist_coeffs_k3()
  • C++

  • C#

  • Python

mmind::eye::CameraIntrinsics intrinsics;
camera.getCameraIntrinsics(intrinsics);

const mmind::eye::Intrinsics2dCamera textureIntrinsics = intrinsics.texture;
const mmind::eye::CameraMatrix cameraMatrix = textureIntrinsics.cameraMatrix;
const double fx = cameraMatrix.fx;
const double fy = cameraMatrix.fy;
const double cx = cameraMatrix.cx;
const double cy = cameraMatrix.cy;

const mmind::eye::CameraDistortion distCoeffs = intrinsics.texture.cameraDistortion;
const double k1 = distCoeffs.k1;
const double k2 = distCoeffs.k2;
const double p1 = distCoeffs.p1;
const double p2 = distCoeffs.p2;
const double k3 = distCoeffs.k3;
var intrinsics = new CameraIntrinsics();
camera.GetCameraIntrinsics(ref intrinsics);

var textureIntrinsics = intrinsics.Texture;

const double fx = textureIntrinsics.CameraMatrix.Fx;
const double fy = textureIntrinsics.CameraMatrix.Fy;
const double cx = textureIntrinsics.CameraMatrix.Cx;
const double cy = textureIntrinsics.CameraMatrix.Cy;

const double k1 = textureIntrinsics.CameraDistortion.K1;
const double k2 = textureIntrinsics.CameraDistortion.K2;
const double p1 = textureIntrinsics.CameraDistortion.P1;
const double p2 = textureIntrinsics.CameraDistortion.P2;
const double k3 = textureIntrinsics.CameraDistortion.K3;
intrinsics = CameraIntrinsics()
camera.get_camera_intrinsics(intrinsics)

texture_intrinsics = intrinsics.texture
camera_matrix = texture_intrinsics.camera_matrix
fx = camera_matrix.fx
fy = camera_matrix.fy
cx = camera_matrix.cx
cy = camera_matrix.cy

camera_distortion = texture_intrinsics.camera_distortion
k1 = camera_distortion.k1
k2 = camera_distortion.k2
p1 = camera_distortion.p1
p2 = camera_distortion.p2
k3 = camera_distortion.k3

Nouvelles fonctions

Plusieurs nouvelles fonctions pratiques ont été ajoutées à Mech-Eye API 2.2.0.

Si vous souhaitez utiliser les nouvelles fonctions suivantes, veuillez modifier votre programme client conformément à ce sujet pour utiliser la version 2.2.0 de Mech-Eye API.

Calculer les normales du nuage de points

En appelant les méthodes suivantes, vous pouvez désormais obtenir directement des données 3D contenant des normales, ce qui réduit la charge de travail du traitement de données ultérieur.

Obtenir un nuage de points non texturé avec normales

  • C++

  • C#

  • Python

mmind::eye::Frame3D frame3D;
camera.capture3DWithNormal(frame3D);

PointCloudWithNormals pointCloud = frame3D.getUntexturedPointCloudWithNormals();
var frame3D = new Frame3D();
camera.Capture3DWithNormal(ref frame3D);

var pointCloud = frame3D.GetUntexturedPointCloudWithNormals();
frame_3d = Frame3D()
camera.capture_3d_with_normal(frame_3d)

point_cloud = frame_3d.get_untextured_point_cloud_with_normals()

Obtenir un nuage de points texturé avec normales

  • C++

  • C#

  • Python

mmind::eye::Frame2DAnd3D frame2DAnd3D;
camera.capture2DAnd3DWithNormal(frame2DAnd3D);

TexturedPointCloudWithNormals pointCloud = frame2DAnd3D.getTexturedPointCloudWithNormals();
var frame2DAnd3D = new Frame2DAnd3D();
camera.Capture2DAnd3DWithNormal(ref frame2DAnd3D);

var pointCloud = frame2DAnd3D.GetTexturedPointCloudWithNormals();
frame_2d_and_3d = Frame2DAnd3D()
camera.capture_2d_and_3d_with_normal(frame_2d_and_3d)

point_cloud = frame_2d_and_3d.get_textured_point_cloud_with_normals()

Enregistrer le nuage de points

En appelant les méthodes suivantes, vous pouvez désormais enregistrer le nuage de points directement aux formats PLY, PCD ou CSV, sans dépendre de bibliothèques logicielles tierces.

Enregistrer un nuage de points non texturé

  • C++

  • C#

  • Python

mmind::eye::Frame3D frame3D;
camera.capture3D(frame3D);

frame3D.saveUntexturedPointCloud(mmind::eye::FileFormat::PLY, "PointCloud.ply");
var frame3D = new frame3D();
camera.Capture3D(ref frame3D);

frame3D.SaveUntexturedPointCloud(FileFormat.PLY, "PointCloud.ply");
frame_3d = Frame3D()
camera.capture_3d(frame_3d)

frame_3d.save_untextured_point_cloud(FileFormat_PLY, "PointCloud.ply")

Enregistrer un nuage de points texturé

  • C++

  • C#

  • Python

mmind::eye::Frame2DAnd3D frame2DAnd3D;
camera.capture2DAnd3D(frame2DAnd3D);

frame2DAnd3D.saveTexturedPointCloud(mmind::eye::FileFormat::PLY, "TexturedPointCloud.ply");
var frame2DAnd3D = new Frame2DAnd3D();
camera.Capture2DAnd3D(ref frame2DAnd3D);

frame2DAnd3D.SaveTexturedPointCloud(FileFormat.PLY, "TexturedPointCloud.ply");
frame_2d_and_3d = Frame2DAnd3D()
camera.capture_2d_and_3d(frame_2d_and_3d)

frame_2d_and_3d.save_textured_point_cloud(FileFormat_PLY, "TexturedPointCloud.ply")

Importer et exporter des groupes de paramètres

En appelant les méthodes suivantes, vous pouvez désormais importer et remplacer tous les groupes de paramètres à partir d’un fichier JSON, ou enregistrer tous les groupes de paramètres dans un fichier JSON.

Importer des groupes de paramètres

  • C++

  • C#

  • Python

camera.userSetManager().loadFromFile("camera_config.json");
camera.UserSetManager().LoadFromFile("camera_config.json");
camera.user_set_manager().load_from_file("camera_config.json")
  • C++

  • C#

  • Python

camera.userSetManager().saveToFile("camera_config.json");
camera.UserSetManager().SaveToFile("camera_config.json");
camera.user_set_manager().save_to_file("camera_config.json")

Vérifier l’état de connexion de la caméra

Le nouveau mécanisme de heartbeat peut être utilisé pour détecter les déconnexions de l’appareil.

Définir l’intervalle du heartbeat

Utilisez la méthode suivante pour définir l’intervalle des signaux de heartbeat :

  • C++

  • C#

  • Python

camera.setHeartbeatInterval(1000);
camera.SetHeartbeatInterval(1000);
camera.set_heartbeat_interval(1000)

Enregistrer la fonction de rappel

Utilisez la méthode suivante pour enregistrer la fonction de rappel qui détecte automatiquement une déconnexion de la caméra et signale une erreur :

  • C++

  • C#

  • Python

mmind::eye::CameraEvent::EventCallback callback = [](mmind::eye::CameraEvent::Event event, void* pUser) {
        std::cout << "A camera event has occurred. The event ID is " << event << "." << std::endl;
    };

mmind::eye::CameraEvent::registerCameraEventCallback(camera, callback, nullptr, mmind::eye::CameraEvent::CAMERA_EVENT_DISCONNECTED);
private static void CallbackFunc(CameraEvent.Event cameraEvent, IntPtr pUser)
{
    Console.WriteLine("A camera event has occurred. The event ID is {0}.", cameraEvent);
}

Utils.ShowError(CameraEvent.RegisterCameraEventCallback(ref camera, CallbackFunc, IntPtr.Zero, (uint)CameraEvent.Event.CAMERA_EVENT_DISCONNECTED));
class CustomCallback(EventCallbackBase):
    def __init__(self):
        super().__init__()

    def run(self, event):
        print("A camera event has occurred. The event ID is {0}.".format(event))

camera_event = CameraEvent()
callback = CustomCallback()
show_error(camera_event.register_camera_event_callback(camera, callback, CameraEvent.CAMERA_EVENT_ALL))

Cette page est-elle utile ?

Veuillez nous indiquer comment améliorer :

Nous accordons de l’importance à votre vie privée

Nous utilisons des cookies pour vous offrir la meilleure expérience possible sur notre site web. En continuant à utiliser le site, vous reconnaissez accepter l’utilisation des cookies. Si vous refusez, un cookie unique sera utilisé pour garantir que vous ne soyez pas suivi ou reconnu lors de votre visite sur ce site.