3. C#¶
This section will show you how to run a C# sample in Windows.
3.1. Sample List¶
Samples are divided into four categories, Basic, Advanced, Util and Laser.
Basic
ConnectToCamera: connect to a camera.
ConnectAndCaptureImage: connect to a camera and capture color images and depth maps.
CaptureColorMap (EmguCV): capture color images from a camera.
CaptureDepthMap (EmguCV): capture depth maps from a camera.
CapturePointCloud (EmguCV): capture point clouds from a camera.
CaptureHDRPointCloud (EmguCV): capture point clouds in HDR mode from a camera.
CapturePointCloudROI (EmguCV): set an ROI and capture point clouds from a camera.
Advanced
CaptureCloudFromDepth (EmguCV): generate point clouds from depth maps and color images.
CaptureTimedAndPeriodically (EmguCV): capture images periodically for a specified length of time.
CaptureSimultaneouslyMultiCamera (EmguCV): capture images from multiple cameras simultaneously.
CaptureSequentiallyMultiCamera (EmguCV): capture images from multiple cameras sequentially.
Util
GetCameraIntri: obtain and print the intrinsic parameters of the camera.
PrintDeviceInfo: print version information of Mech-Eye SDK and the camera firmware.
SetDepthRange: set the depth range of a camera.
SetUserSets: provide functions related to parameter groups, such as switching to a different parameter group, adding and deleting parameter groups, etc.
SetParameters: provide functions related to camera parameters, including all the functions of SetUserSets.
Laser
SetLaserFramePartitionCount: set the laser scan partition number for a laser camera.
SetLaserFrameRange: set the field of view for a laser camera.
SetLaserFringeCodingMode: set the fringe coding mode for a laser camera.
SetLaserPowerLevel: set the power level for a laser camera.
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.