Operation Workflow

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.

This topic introduces the basic workflow of using Mech-Eye API to control a camera. The figure and descriptions in this topic use the class and method names of C++ Mech-Eye API. For the corresponding names of different languages, please refer to the example codes.

operation workflow

Discover

Call the discoverCameras() method in the Camera class to enumerate all currently connectable cameras and obtain the information of each camera.

  • C++

  • C#

  • Python

std::vector<mmind::eye::CameraInfo> cameraInfoList = mmind::eye::Camera::discoverCameras();
var cameraInfoList = Camera.DiscoverCameras();
camera_info_list = Camera.discover_cameras()

Connect

After instantiating the Camera class, call the connect() method in this class to connect to the corresponding camera using the IP address or the device information obtained by the discoverCameras() method.

  • C++

  • C#

  • Python

mmind::eye::Camera camera;
mmind::eye::ErrorStatus status = camera.connect(cameraInfoList[inputIndex]);
mmind::eye::Camera cameras;
mmind::eye::ErrorStatus status = camera.connect("192.168.0.10");
var camera = new Camera();
var status = camera.Connect(cameraInfoList[inputIndex]);
var camera = new Camera();
var status = camera.Connect("192.168.0.10");
camera = Camera()
camera.connect("192.168.0.10")

Configure

Call the methods in the UserSetManager and UserSet classes to select the parameter group on the camera and adjust the parameters.

  1. Call the selectUserSet method in the UserSetManager class to select the parameter group to be used.

    You can obtain all the available parameter groups on the camera through the getAllUserSetNames() method in this class.
    • C++

    • C#

    • Python

    mmind::eye::UserSetManager userSetManager = camera.userSetManager();
    std::vector<std::string> userSets;
    auto status = userSetManager.getAllUserSetNames(userSets);
    status = userSetManager.selectUserSet(userSets.front());
    var userSetManager = camera.UserSetManager();
    List<string> userSets = new List<string>();
    var status = userSetManager.GetAllUserSetNames(ref userSets);
    status = userSetManager.SelectUserSet(userSets[0]);
    user_set_manager = camera.userSetManager()
    error, user_sets = user_set_manager.get_all_user_set_names()
    user_set_manager.select_user_set(user_sets[0])
  2. Call the getAvailableParameters() method in the UserSet class to obtain the information of all the parameters in the current parameter group and check the data type of each parameter.

    • C++

    • C#

    • Python

    mmind::eye::UserSet currentUserSet = camera.currentUserSet();
    std::vector<Parameter*> parameters = currentUserSet.getAvailableParameters();
    var currentUserSet = camera.CurrentUserSet();
    var parameters = currentUserSet.GetAvailableParameters();
    current_user_set = camera.current_user_set()
    arameters = current_user_set.get_available_parameters()
  3. Call the getIntValue() and other similar methods in the UserSet class to obtain the current value of a parameter.

    • C++

    • C#

    • Python

    int fringeContrastThreshold = 0;
    currentUserSet.getIntValue(mmind::eye::pointcloud_processing_setting::FringeContrastThreshold::name, fringeContrastThreshold);
    var fringeContrastThreshold = new int();
    camera.CurrentUserSet().GetIntValue(MMind.Eye.PointCloudProcessingSetting.FringeContrastThreshold.Name, ref fringeContrastThreshold);
    error, fringe_contrast_threshold = current_user_set.get_int_value(PointCloudFringeContrastThreshold.name)
  4. Call the setIntValue() and other similar methods in the UserSet class to set the value of a parameter.

    • C++

    • C#

    • Python

    auto status = currentUserSet.setIntValue(mmind::eye::pointcloud_processing_setting::FringeContrastThreshold::name, 15);
    var status = currentUserSet.SetIntValue(MMind.Eye.PointCloudProcessingSetting.FringeContrastThreshold.Name, 15);
    status = current_user_set.set_int_value(PointCloudFringeContrastThreshold.name, 15)
  5. Call the saveAllParametersToDevice() method in the UserSet class to save the set parameter values to the camera.

    • C++

    • C#

    • Python

    auto status = currentUserSet.SaveAllParametersToDevice();
    var status = currentUserSet.SaveAllParametersToDevice();
    status = current_user_set.save_all_parameters_to_device()

Acquire and Retrieve Data

Mech-Eye API provides various methods for acquiring and retrieving different types of data. Using these methods, you can obtain the 2D and 3D data separately or together.

  • Acquire and retrieve the data for generating the 2D image:

    • C++

    • C#

    • Python

    mmind::eye::Frame2D frame2D;
    camera.capture2D(frame2D);
    mmind::eye::Color2DImage color = frame2D.getColorImage();
    mmind::eye::GrayScale2DImage gray= frame2D.getGrayScaleImage();
    var frame = new Frame2D();
    camera.Capture2D(ref frame);
    var color = frame.GetColorImage();
    var gray = frame.GetGrayScaleImage();
    frame_2d = Frame2D()
    camera.capture_2d(frame_2d)
    color = frame.get_color_image()
    gray = frame.get_gray_scale_image()
  • Acquire and retrieve the data for generating the depth map and untextured point cloud:

    • C++

    • C#

    • Python

    mmind::eye::Frame3D frame3D;
    camera.capture3D(frame3D);
    mmind::eye::DepthMap depth = frame3D.getDepthMap();
    mmind::eye::PointCloud cloud= frame3D.getUntexturedPointCloud();
    var frame = new Frame3D();
    camera.Capture3D(ref frame);
    var depth = frame.GetDepthMap();
    var cloud = frame.GetUntexturedPointCloud();
    frame_3d = Frame3D()
    camera.capture_3d(frame_3d)
    depth = frame.get_depth_map()
    cloud = frame_3d.get_untextured_point_cloud()
  • Acquire and retrieve the data for generating the 2D image, depth map, and textured point cloud:

    • C++

    • C#

    • Python

    mmind::eye::Frame2DAnd3D frame2DAnd3D;
    camera.capture2DAnd3D(frame2DAnd3D);
    mmind::eye::Color2DImage color = frame2DAnd3D.frame2D().getColorImage();
    mmind::eye::DepthMap depth = frame2DAnd3D.frame3D().getDepthMap();
    mmind::eye::TexturedPointCloud cloud = frame2DAnd3D.getTexturedPointCloud();
    var frame = new Frame2DAnd3D();
    camera.Capture2DAnd3D(ref frame);
    var color = frame2DAnd3D.Frame2D().GetColorImage();
    var depth = frame2DAnd3D.Frame3D().GetDepthMap();
    var cloud = frame2DAnd3D.GetTexturedPointCloud();
    frame = Frame2DAnd3D()
    camera.capture_2d_and_3d(frame)
    color = frame.frame_2d().get_color_image()
    depth = frame.frame_3d().get_depth_image()
    cloud = frame.get_textured_point_cloud()
  • Acquire and retrieve the data for generating the depth map and untextured point cloud with normals:

    • C++

    • C#

    • Python

    mmind::eye::Frame3D frame3D;
    camera.capture3DWithNormal(frame3D);
    mmind::eye::DepthMap depth = frame3D.getDepthMap();
    PointCloudWithNormals pointCloud = frame3D.getUntexturedPointCloudWithNormals();
    var frame3D = new Frame3D();
    camera.Capture3DWithNormal(ref frame3D);
    var depth = frame3D.GetDepthMap();
    var pointCloud = frame3D.GetUntexturedPointCloudWithNormals();
    frame_3d = Frame3D()
    camera.capture_3d_with_normal(frame_3d)
    depth = frame_3d.get_depth_map()
    point_cloud = frame_3d.get_untextured_point_cloud_with_normals()
  • Acquire and retrieve the data for generating the 2D image, depth map, and textured point cloud with normals:

    • C++

    • C#

    • Python

    mmind::eye::Frame2DAnd3D frame2DAnd3D;
    camera.capture2DAnd3DWithNormal(frame2DAnd3D);
    mmind::eye::Color2DImage color = frame2DAnd3D.frame2D().getColorImage();
    mmind::eye::DepthMap depth = frame2DAnd3D.frame3D().getDepthMap();
    TexturedPointCloudWithNormals pointCloud = frame2DAnd3D.getTexturedPointCloudWithNormals();
    var frame2DAnd3D = new Frame2DAnd3D();
    camera.Capture2DAnd3DWithNormal(ref frame2DAnd3D);
    var color = frame2DAnd3D.Frame2D().GetColorImage();
    var depth = frame2DAnd3D.Frame3D().GetDepthMap();
    var pointCloud = frame2DAnd3D.GetTexturedPointCloudWithNormals();
    frame_2d_and_3d = Frame2DAnd3D()
    camera.capture_2d_and_3d_with_normal(frame_2d_and_3d)
    color = frame_2d_and_3d.frame_2d().get_color_image()
    depth = frame_2d_and_3d.frame_3d().get_depth_map()
    point_cloud = frame_2d_and_3d.get_textured_point_cloud_with_normals()

Disconnect

Call the disconnect() method in the Camera class to disconnect from the current camera.

  • C++

  • C#

  • Python

camera.disconnect();
camera.Disconnect();
camera.disconnect()

This topic introduced the basic workflow of using Mech-Eye API to control a camera. The next topic provides the reference manual for Mech-Eye API.

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.