Migration Guide from Version 2.1.0 to Version 2.2.0

You are viewing an old version of the documentation. You can switch to the documentation of the latest version by clicking the top-right corner of the page.

Mech-Eye API 2.2.0 has been restructured to provide a clearer structure while keeping all the previously available functions. New functions have also been added.

This topic lists the main changes of Mech-Eye API 2.2.0 compared to Mech-Eye API 2.1.0. If you wish to use the 2.2.0 version of Mech-Eye API in your existing client program, you can refer to this topic and modify your client program.

Import Modules

In Mech-Eye API 2.2.0, the following changes have been made to the statement for importing 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 *

Create Camera Object

In Mech-Eye API 2.2.0, the following changes have been made to the statement for creating an object representing the cameras:

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()

Discover and Connect to Camera

In Mech-Eye API 2.2.0, the following changes have been made to the statement for discovering and connecting to a camera:

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])

Manage Parameter Groups

Mech-Eye API 2.2.0 uses classes to organize the functions related to parameter groups and parameters. For details, please refer to Functional Hierarchy of Classes. The changes to frequently used functions are listed here.

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()

Set and Obtain Parameter Values

Mech-Eye API 2.2.0 uses classes to organize the functions related to parameter groups and parameters. For details, please refer to Functional Hierarchy of Classes.

Meanwhile, Mech-Eye API 2.2.0 provides methods for setting and obtaining parameters according to the data types of the parameters.

The following data types of parameters are distinguished in Mech-Eye API 2.2.0:

  • _Int

  • _Float

  • _Bool

  • _Enum

  • _Roi

  • _Range

  • _FloatArray

The following sections provide examples of each data type.

_Int Type

The Stripe Contrast Threshold parameter in the Point Cloud Processing category is used as an example.

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

The Exposure Time parameter in the 2D Parameters category is used as an example.

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

The Tone Mapping parameter in the 2D Parameters category is used as an example.

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

The Surface Smoothing parameter in the Point Cloud Processing category is used as an example.

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

The ROI parameter is used as an example.

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

The Depth Range parameter is used as an example.

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

The Exposure Time parameters in the 3D Parameters category is used as an example.

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)

Acquire data

In Mech-Eye API 2.2.0, the following changes have been made to the statements for acquiring data:

Acquire 2D Image

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()

Acquire Depth Map

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()

Acquire Untextured Point Cloud

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()

Acquire Textured Point Cloud

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()

Obtain Camera Information and Properties

Mech-Eye API 2.2.0 uses classes to organize the information and properties of the camera. For details, please refer to Functional Hierarchy of Classes.

Obtain Camera Information

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)

Obtain Camera Temperatures

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

Obtain Image Resolutions

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

Obtain Camera Intrinsic Parameters

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

New Functions

Multiple convenient new functions have been added to Mech-Eye API 2.2.0.

If you want to use the following new functions, please modify your client program according to this topic to use the 2.2.0 version of Mech-Eye API.

Compute Point Cloud Normals

By calling the following methods you can now obtain 3D data containing normals directly, reducing the workload of subsequent data processing.

Obtain Untextured Point Cloud with Normals

  • 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()

Obtain Textured Point Cloud with Normals

  • 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()

Save Point Cloud

By calling the following methods, you can now save the point cloud in PLY, PCD or CSV format directly, without the need to reply on any third-party software libraries.

Save Untextured Point Cloud

  • 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")

Save Textured Point Cloud

  • 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")

Import and Export Parameter Groups

By calling the following methods, you can now import and replace all parameter groups from a JSON file, or save all parameter groups to a JSON file.

Import parameter groups

  • 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")

Check Camera Connection Status

The new heartbeat mechanism can be used to detect device disconnections.

Set Heartbeat Interval

Use the following method to set the interval of the heartbeat signals:

  • C++

  • C#

  • Python

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

Register Callback Function

Use the following method to register the callback function that automatically detects a camera disconnection and reports error:

  • 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))

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.