3. C#¶
This section will show you how to run a C# sample in Windows.
3.1. Sample List¶
Samples are divided into five categories, Basic, Advanced, Util, Laser and UHP.
Basic: camera connection and basic capturing functions.
Advanced: advanced capturing functions.
Util: obtain information from a camera and set camera parameters.
Laser: for Laser/LSR series cameras only.
UHP: for UHP series cameras only.
Basic
ConnectToCamera: Connect to a Mech-Eye Industrial 3D Camera.
ConnectAndCaptureImage: Connect to a camera and obtain 2D image, depth map and 3D image.
CaptureColorMap (EmguCV): Obtain 2D image in OpenCV format from a camera.
CaptureDepthMap (EmguCV): Obtain depth map in OpenCV format from a camera.
CapturePointCloud (EmguCV): Obtain untextured and textured point clouds (PCL format) generated from images captured with a single exposure time.
CaptureHDRPointCloud (EmguCV): Obtain untextured and textured point clouds (PCL format) generated from images captured with multiple exposure times.
CapturePointCloudROI (EmguCV): Obtain untextured and textured point clouds (PCL format) of the objects in the ROI from a camera.
Advanced
CaptureCloudFromDepth (EmguCV): Construct point clouds from depth map and 2D image captured from a camera.
CaptureTimedAndPeriodically (EmguCV): Obtain 2D image, depth map and 3D images sequentially from multiple cameras.
CaptureSimultaneouslyMultiCamera (EmguCV): Obtain 2D image, depth map and 3D images simultaneously from multiple cameras.
CaptureSequentiallyMultiCamera (EmguCV): Obtain 2D image, depth map and 3D images periodically for the specified duration from a camera.
Util
GetCameraIntri: Get and print a camera’s intrinsic parameters.
PrintDeviceInfo: Get and print a camera’s information such as model, serial number and firmware version.
SetDepthRange: Set the range of depth values to be retained by a camera.
SetParameters: Set specified parameters to a camera.
SetUserSets: provide functions related to parameter groups, such as switching to a different parameter group, adding and deleting parameter groups, etc.
Laser
SetLaserFramePartitionCount: Divide the projector FOV into partitions and project structured light in one partition at a time. The output of the entire FOV is composed from images of all partitions.
SetLaserFrameRange: Set the projection range of the structured light. The entire projector FOV is from 0 to 100.
SetLaserFringeCodingMode: Set the coding mode of the structured light pattern.
SetLaserPowerLevel: Set the output power of the laser projector in percentage of max power. This affects the intensity of the laser light.
UHP
SetUHPCaptureMode: Set the capture mode (capture images with camera 1, with camera 2, or with both 2D cameras and compose the outputs).
SetUHPFringeCodingMode: Set the coding mode of the structured light pattern.
3.2. Requirements¶
-
It is recommended to use Visual Studio 2019 or Visual Studio 2015.
Choose and install workloads and individual components in Visual Studio
Workloads: .NET desktop development, Desktop development with C++, Universal Windows Platform developmentIndividual components: .NET Framework 4.8 targeting packThe samples marked with (EmguCV) must be installed via NuGet Package Manager Emgu.CV.runtime.windows. Please refer to Install and manage packages in Visual Studio using the NuGet Package Manager for detailed instructions.
3.3. Instructions¶
3.3.1. Build Solution in Visual Studio¶
Open MechEyeCSharpSamples.sln in Visual Studio.
Change the Solution Configuration from Debug to Release.
Build solution.
3.3.2. Run Sample Program¶
The example below shows how to run CaptureColorMap.exe.
Go to
.Double-click on CaptureColorMap.exe.
While the program is running, please follow the instructions to input the camera index, and then wait for the program to finish.
After running the program, you will get colorMap in Build directory.