VisionPro

This topic introduces how to use the VisionPro sample provided by Mech-Mind to connect to the camera and obtain 2D and 3D data through C# Mech-Eye API.

Sample List

The following sample is currently provided:

AcquireColorAndRangeImages: Obtain 2D and depth data and generate the Cognex-format 2D image (CogImage24PlanarColor) and depth map (CogImage16Range).

Prerequisites

In order to use the VisionPro sample, the following prerequisites must be satisfied:

Obtain Sample

VisionPro sample is included in the installation path of Mech-Eye SDK or can be obtained from GitHub by cloning. The sample in the installation path is the version at the time of Mech-Eye SDK release. The version on GitHub may contain the latest changes.

  • The sample in the installation path is located in xxx/Mech-Eye SDK-2.3.2/API/samples/visionpro/area_scan_3d_camera.

  • The sample cloned from GitHub is located in xxx/mecheye_visionpro_samples/area_scan_3d_camera.

Install Required Software

In order to use the VisionPro sample, Mech-Eye SDK and VisionPro must be installed.

Configure and Run Sample

The sample can be run after the necessary configurations are completed.

Copy Dynamic-Link Libraries

To call Mech-Eye API in VisionPro, the dynamic-link libraries of Mech-Eye SDK must be copied to the installation path of VisionPro first.

Follow these steps to copy the dynamic-link libraries:

  1. Go to the installation path of Mech-Eye SDK and open the following folder: xxx/Mech-Eye SDK-2.3.2/API/dll.

  2. Copy the following dynamic-line library files (.dll) in the above folder:

    • MechEyeApi

    • MechEyeAPiNet

    • MechEyeApiWrapper

  3. Go to the installation path of VisionPro, open the bin folder, and paste the copied dynamic-link library files.

Configure Referenced Assembly of Script

After copying the dynamic-link libraries, you need to configure the path of the referenced assembly in the script of the sample.

Follow these steps to configure the referenced assembly:

  1. Open VisionPro QuickBuild and select Open QuickBuild Application in the File menu.

  2. In the pop-up window, select the VisionPro sample to be used, and click the Open button.

  3. The following window will pop-up. Click the No button in the window to close it.

    pop up 1
  4. The following window may pop-up. If it pops up, click the OK button in the window to close it.

    pop up 2
  5. In the left panel of VisionPro QuickBuild, double-click Mech-Eye Industrial 3D Camera.

  6. In the left panel of the popped up Job Editor window, double-click Image Acquisition.

  7. In the toolbar of the popped up Image Acquisition window, click the create edit script button.

  8. In the toolbar of the popped up Image Acquisition Script window, click the add remove reference button.

  9. In the popped up Add / Remove Referenced Assemblies window, scroll down to the bottom and double-click the MechEyeApiNet.dll row.

  10. In the popped up Enter Assembly Name window, click the Browse...…​ button, navigate to the folder where the dynamic-link libraries are located in the Mech-Eye SDK installation path (xxx/Mech-Eye SDK-2.3.2/API/dll), and select the MechEyeApiNet dynamic-link library file.

  11. Click the OK button in the Enter Assembly Name window to close it, and then click the OK button in the Add / Remove Referenced Assemblies window to close it.

Set Camera IP Address

Before running the sample, you need to set the IP address of the camera in the script, so that the camera can be successfully connected.

You can modify the IP address of the camera using Mech-Eye Viewer or the IP configuration tool.

Follow these steps to set the IP address of the camera:

  1. In the Image Acquisition Script window, locate the following line and change the IP address in it to the actual IP address of the camera to be connected.

    static string cameraIp="192.168.23.245";
  2. Click the build button in the toolbar to make the change take effect.

  3. Close the Image Acquisition Script and Image Acquisition windows to return to the Job Editor window.

Run Sample

Follow these steps to run the sample and view the obtained 2D image and depth map:

  1. In the toolbar of the Job Editor window, click the run job once button to run the sample.

  2. In the left panel, double-click the corresponding tool to view the obtained 2D image or depth map:

    • 2D image: Double-click CogAffineTransformTool1.

    • Depth map: Double-click Cog3DVisionDataReRenderTool1.

  3. If the obtained images do not meet your requirements, refer to the next section and adjust the camera parameters to improve the quality of the data.

Adjust Camera Parameters

The camera parameters can be adjusted in Mech-Eye Viewer or in the sample through C# Mech-Eye API. It is recommended to use Mech-Eye Viewer to adjust parameters, as it provides a graphical user interface where you can acquire data immediately after adjusting the parameters to see the effect.

  • Adjust parameters using Mech-Eye Viewer: Please refer to How to Use for instructions on connecting to the camera, acquiring data, viewing current parameter values, and adjusting parameters in Mech-Eye Viewer.

  • Adjust parameters in the sample through C# Mech-Eye API: To adjust the camera parameters in the sample, you need to add the corresponding methods of C# Mech-Eye API to the script of the sample. Please refer to the following contents and edit the script of the sample.

    • C# Mech-Eye API samples: Refer to C# for an overview of the available samples, where to obtain them, and how to use them.

    • Mech-Eye API Reference: Explanations of the methods in C++ Mech-Eye API are provided here.