C#

This section will show you how to run a C# sample in Windows.

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 and DEEP series cameras only.

  • UHP: for UHP series cameras only.

Requirements

  1. Download Visual Studio 2019

    It is recommended to use Visual Studio 2019 or Visual Studio 2015.
  2. Choose and install workloads and individual components in Visual Studio

    Workloads: .NET desktop development, Desktop development with C++, Universal Windows Platform development
    ../../../_images/workloads.png
    Individual components: .NET Framework 4.8 targeting pack
    ../../../_images/sample_csharp_component.png
  3. Download and install Mech-Eye SDK

  4. Download samples from GitHub: select Code ‣ Download as ZIP.

    ../../../_images/python_sample_download.png
  5. Connect a functioning camera

  6. To use the following samples, Emgu.CV.runtime.windows must be installed in Visual Studio via Project ‣ Manage NuGet Packages. Please refer to Install and manage packages in Visual Studio using the NuGet Package Manager for detailed instructions.

    • CaptureColorMap

    • CaptureDepthMap

    • CapturePointCloud

    • CaptureHDRPointCloud

    • CapturePointCloudROI

    • CapturePointCloudFromTextureMask

    • CaptureCloudFromDepth

    • CaptureSequentiallyMultiCamera

    • CaptureSimultaneouslyMultiCamera

    • CaptureTimedAndPeriodically

Instructions

Build Solution in Visual Studio

  1. Open MechEyeCSharpSamples.sln in Visual Studio.

    ../../../_images/csharp_open_project.png
    ../../../_images/csharp_chose_project.png
  2. Change the Solution Configuration from Debug to Release.

    ../../../_images/csharp_set_release.png
  3. Build solution.

    Right-click Solution ‘MechEyeCSharpSamples’ in the Solution Explorer, and click Build Solution in the context menu.

    ../../../_images/csharp_build_solution.png

Run Sample Program

The example below shows how to run CaptureColorMap.exe.

  1. Go to mecheye_csharp_samples-master ‣ source ‣ Build.

  2. Double-click CaptureColorMap.exe.

    While the program is running, please follow the instructions to input the camera index, and then wait for the program to finish.

  3. After running the program, you will get colorMap in Build directory.

    ../../../_images/csharp_color.png