Migration Guide from Version 2.1.0 to Version 2.2.0
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 |
---|---|
|
|
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 |
---|---|
|
|
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 |
---|---|
|
|
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 |
---|---|
|
|
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 |
---|---|
|
|
_Float Type
The Exposure Time parameter in the 2D Parameters category is used as an example.
2.1.0 | 2.2.0 |
---|---|
|
|
_Bool Type
The Tone Mapping parameter in the 2D Parameters category is used as an example.
2.1.0 | 2.2.0 |
---|---|
|
|
_Enum Type
The Surface Smoothing parameter in the Point Cloud Processing category is used as an example.
2.1.0 | 2.2.0 |
---|---|
|
|
_Roi Type
The ROI parameter is used as an example.
2.1.0 | 2.2.0 |
---|---|
|
|
_Range Type
The Depth Range parameter is used as an example.
2.1.0 | 2.2.0 |
---|---|
|
|
_FloatArray Type
The Exposure Time parameters in the 3D Parameters category is used as an example.
2.1.0 | 2.2.0 |
---|---|
|
|
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 |
---|---|
|
|
Acquire Depth Map
2.1.0 | 2.2.0 |
---|---|
|
|
Acquire Untextured Point Cloud
2.1.0 | 2.2.0 |
---|---|
|
|
Acquire Textured Point Cloud
2.1.0 | 2.2.0 |
---|---|
|
|
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 |
---|---|
|
|
Obtain Camera Temperatures
2.1.0 | 2.2.0 |
---|---|
|
|
Obtain Image Resolutions
2.1.0 | 2.2.0 |
---|---|
|
|
Obtain Camera Intrinsic Parameters
2.1.0 | 2.2.0 |
---|---|
|
|
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))