Migration Guide from Version 2.1.0 to Version 2.2.0

You are currently viewing the documentation for version 2.4.1. To access documentation for other versions, click the "Switch Version" button located in the upper-right corner of the page.

■ To use the latest version, visit the Mech-Mind Download Center to download it.

■ If you're unsure about the version of the product you are using, please contact Mech-Mind Technical Support for assistance.

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
#include "MechEyeApi.h"

using namespace mmind::api;
c++
#include "Camera.h"

using namespace mmind::eye;
c++

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
mmind::api::MechEyeDevice device;
c++
mmind::eye::Camera camera;
c++

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
std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList = mmind::api::MechEyeDevice::enumerateMechEyeDeviceList();

mmind::api::MechEyeDevice device;
device.connect(deviceInfoList[0]);
c++
std::vector<mmind::eye::CameraInfo> cameraInfoList = mmind::eye::Camera::discoverCameras();

mmind::eye::Camera camera;
camera.connect(cameraInfoList[0]);
c++

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
std::vector<std::string> userSets;
device.getAllUserSets(userSets);

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

device.setCurrentUserSet(userSets.front());

device.addUserSet("NewSetting");

device.saveAllSettingsToUserSets();
c++
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();
c++

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
device.setFringeContrastThreshold(15);

int fringeContrastThreshold = 0;
device.getFringeContrastThreshold(fringeContrastThreshold);
c++
#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);
c++

_Float Type

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

2.1.0 2.2.0
device.setScan2DExposureTime(100);

double scan2DExposureTime = 0;
device.getScan2DExposureTime(scan2DExposureTime);
c++
#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);
c++

_Bool Type

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

2.1.0 2.2.0
device.setScan2DToneMappingEnable(true);

bool toneMappingEnable = false;
device.getScan2DToneMappingEnable(toneMappingEnable);
c++
#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);
c++

_Enum Type

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

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

mmind::api::PointCloudProcessingSettings::PointCloudSurfaceSmoothing surfaceSmoothing;
device.getCloudSurfaceSmoothingMode(surfaceSmoothing);
c++
#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);
c++

_Roi Type

The ROI parameter is used as an example.

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

mmind::api::ROI roi;
device.getScan3DROI(roi);
c++
#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);
c++

_Range Type

The Depth Range parameter is used as an example.

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

mmind::api::DepthRange depthRange;
device.getDepthRange(depthRange);
c++
#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);
c++

_FloatArray Type

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

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

std::vector<double> exposureSequence;
device.getScan3DExposure(exposureSequence);
c++
#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);
c++

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
mmind::api::ColorMap color;
device.captureColorMap(color);
c++
mmind::eye::Frame2D frame2D;
camera.capture2D(frame2D);
mmind::eye::Color2DImage color = frame3D.getColorImage();
c++

Acquire Depth Map

2.1.0 2.2.0
mmind::api::DepthMap depth;
device.captureDepthMap(depth);
c++
mmind::eye::Frame3D frame3D;
camera.capture3D(frame3D);
mmind::eye::DepthMap depth = frame3D.getDepthMap();
c++

Acquire Untextured Point Cloud

2.1.0 2.2.0
mmind::api::PointXYZMap pointXYZMap;
device.capturePointXYZMap(pointXYZMap);
c++
mmind::eye::Frame3D frame3D;
camera.capture3D(frame3D);
mmind::eye::PointCloud cloud = frame3D.getUntexturedPointCloud();
c++

Acquire Textured Point Cloud

2.1.0 2.2.0
mmind::api::PointXYZBGRMap pointXYZBGRMap;
device.capturePointXYZBGRMap(pointXYZBGRMap);
c++
mmind::eye::Frame2DAnd3D frame2DAnd3D;
camera.capture2DAnd3D(frame2DAnd3D);
mmind::eye::TexturedPointCloud cloud = frame2DAnd3D.getTexturedPointCloud();
c++

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
mmind::api::MechEyeDeviceInfo deviceInfo;
device.getDeviceInfo(deviceInfo);

std::string model = deviceInfo.model;
std::string serialNumber = deviceInfo.id;
std::string firmwareVersion = deviceInfo.firmwareVersion;
c++
mmind::eye::CameraInfo cameraInfo;
camera.getCameraInfo(cameraInfo);

std::string model = cameraInfo.model;
std::string serialNumber = cameraInfo.serialNumber;
std::string firmwareVersion = cameraInfo.firmwareVersion.toString();
c++

Obtain Camera Temperatures

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

float cpu = devicetemperature.cpuTemperature;
float projector = devicetemperature.projectorModuleTemperature;
c++
mmind::eye::CameraStatus cameraStatus;
camera.getCameraStatus(cameraStatus);

float cpu = cameraStatus.temperature.cpuTemperature;
float projector = cameraStatus.temperature.projectorTemperature;
c++

Obtain Image Resolutions

2.1.0 2.2.0
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;
c++
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;
c++

Obtain Camera Intrinsic Parameters

2.1.0 2.2.0
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];
c++
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;
c++

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

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

PointCloudWithNormals pointCloud = frame3D.getUntexturedPointCloudWithNormals();
C++

Obtain Textured Point Cloud with Normals

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

TexturedPointCloudWithNormals pointCloud = frame2DAnd3D.getTexturedPointCloudWithNormals();
C++

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

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

frame3D.saveUntexturedPointCloud(mmind::eye::FileFormat::PLY, "PointCloud.ply");
C++

Save Textured Point Cloud

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

frame2DAnd3D.saveTexturedPointCloud(mmind::eye::FileFormat::PLY, "TexturedPointCloud.ply");
C++

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

camera.userSetManager().loadFromFile("camera_config.json");
C++
camera.userSetManager().saveToFile("camera_config.json");
C++

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:

camera.setHeartbeatInterval(1000);
C++

Register Callback Function

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

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);
C++

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.