8.9 KiB
C++ Samples for Mech-Eye 3D Laser Profiler
This documentation provides descriptions of Mech-Eye API C++ samples for Mech-Eye 3D Laser Profiler and instructions for building all the samples at once.
If you have any questions or have anything to share, feel free to post on the Mech-Mind Online Community. The community also contains a specific category for development with Mech-Eye SDK.
Sample List
Currently, the following samples are provided.
The samples marked with (OpenCV) require OpenCV to be installed.
- TriggerWithSoftwareAndFixedRate
(OpenCV)
Trigger data acquisition with signals input from software, trigger line scans at a fixed rate, and then retrieve and save the acquired data. - TriggerWithExternalDeviceAndFixedRate
(OpenCV)
Trigger data acquisition with signals input from the external device, trigger line scans at a fixed rate, and then retrieve and save the acquired data. - TriggerWithSoftwareAndEncoder
(OpenCV)
Trigger data acquisition with signals input from software, trigger line scans with signals input from the encoder, and then retrieve and save the acquired data. - TriggerWithExternalDeviceAndEncoder
(OpenCV)
Trigger data acquisition with signals input from the external device, trigger line scans with signals input from the encoder, and then retrieve and save the acquired data. - TriggerMultipleProfilersSimultaneously
(OpenCV)
Trigger multiple laser profilers to acquire data asynchronously and retrieve the acquired data. - TriggerNonStopAcquisition
(OpenCV)
Trigger non-stop acquisition, and then retrieve and save the acquired data. - BlindSpotFiltering
(OpenCV)
Detect and remove the false data caused by blind spots and obtain the filtered profile data. - NoiseRemoval
(OpenCV)
Remove the noise in the depth data and obtain the filtered profile data. - ProfileAlignment
(OpenCV)
Correct the X-axis and Z-axis vibrations in the profiles (aligning the profiles) and obtain the corrected profile data. - RenderDepthMap
(OpenCV)
Obtain and save the depth map rendered with the jet color scheme. - TransformPointCloud
Obtain and save the point clouds in the custom reference frame. - ManageUserSets
Manage parameter groups, such as obtaining the names of all parameter groups, adding a parameter group, switching the parameter group, and saving parameter settings to the parameter group. - PrintProfilerStatus
Obtain and print the laser profiler's information, such as model, serial number, firmware version, and temperatures. - RegisterProfilerEvent
Define and register the callback function for monitoring laser profiler events. - UseVirtualDevice
(OpenCV)
Acquire the profile data stored in a virtual device, generate the intensity image and depth map, and save the images.
Build the Samples
The instructions provided here allow you to build all the samples at once.
Windows
Prerequisites
Please download and install the required software listed below.
Optional software: If you need to build the samples dependent on third-party software (refer to the Sample List above), please install the corresponding software.
Instructions
-
Make sure that the samples are stored in a location with read and write permissions.
-
If OpenCV is installed, add the following directories to the Path environment variable:
xxx/opencv/build/x64/vc14/binxxx/opencv/build/x64/vc14/lib
-
(Optional) Disable unneeded samples: if OpenCV is installed, this step must be performed.
Open the CMakeLists file in
xxx/profiler, and change ON to OFF in the line that starts withoption(USE_OPENCV. -
Run Cmake and set the source and build paths:
Field Path Where is the source code xxx/profiler Where to build the binaries xxx/profiler/build -
Click the Configure button. In the pop-up window, set the generator and platform according to the actual situation, and then click the Finish button.
-
When the log displays Configuring done, click the Generate button. When the log displays Generating done, click the Open Project button.
-
In Visual Studio toolbar, change the solution configuration from Debug to Release.
-
In the menu bar, select Build > Build Solution. An EXE format executable file is generated for each sample. The executable files are saved to the
Releasefolder, located in the Where to build the binaries directory. -
In the Solution Explorer panel, right-click a sample, and select Set as Startup Project.
-
Click the Local Windows Debugger button in the toolbar to run the sample.
-
Enter the index of the laser profiler to which you want to connect, and press the Enter key. The obtained files are saved to the
Releasefolder.
Ubuntu
Ubuntu 18 or above is required.
Prerequisites
-
Update the software source list.
sudo apt-get update -
Install required tools.
sudo apt-get install -y build-essential pkg-config cmake -
Install Mech-Eye SDK (latest version).
Note: If you have installed Mech-Eye SDK before, please uninstall it first with the following command:
sudo dpkg -P MechEyeApi-
If the system architecture is AMD64, execute the following command:
sudo dpkg -i 'Mech-Eye_API_x.x.x_amd64.deb' -
If the system architecture is ARM64, execute the following command:
sudo dpkg -i 'Mech-Eye_API_x.x.x_arm64.deb'
-
-
Install optional third-party libraries: If you need to build the samples dependent on third-party software (refer to the Sample List above), please install the corresponding software.
-
Install OpenCV (latest version):
sudo apt update && sudo apt install -y unzip wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip unzip opencv.zip mkdir build && cd build cmake ../opencv-4.x cmake --build . sudo make install
-
Instructions
-
Navigate to the directory of the sample.
cd xxx/profiler/ -
(Optional) Disable unneeded samples: if any of the optional software is not installed, this step must be performed.
Open the CMakeLists file in
xxx/profiler/, and change ON to OFF in the options of the unneeded samples. -
Configure and build the samples.
sudo mkdir build && cd build sudo cmake .. sudo make -
Run a sample. Replace
SampleNamewith the name of the sample that you want to run.sudo ./SampleName -
Enter the index of the laser profiler to which you want to connect, and press the Enter key. The obtained files are saved to
xxx/profiler/build.
License
Mech-Eye Samples are distributed under the BSD license.