Run Advanced Sample with OpenCV
You can build and run the provided sample by the following instructions if you have completed all operations required in the Prerequisites section.
Install OpenCV
-
Download and install OpenCV (C# version), namely, OpenCvSharp. Please note down the directory of OpenCvSharp.
-
Find the
MechDLCShapeWithOpenCVSamples.sln
file under xxx\mechdlk_sdk\samples\csharp and double-click the file to open the solution in Visual Studio. -
In the Solution Explorer panel, select
. Right-click References and select Add Reference. -
In the pop-up Reference Manager dialog box, click Browse in the lower-right corner.
-
In the directory of OpenCvSharp, find and select the
OpenCvSharp.dll
file from the path xxx\ManagedLib\net461 and then click Add. -
In the Reference Manager dialog box, click OK to finish reference adding.
The provided sample was tested with OpenCvSharp 4.5.3. The directory of the DLL file may differ for different OpenCvSharp versions. Please follow the above steps according to the actual situation. |
Build the Sample
-
In the Visual Studio menu bar, select
. An executable file will be generated and saved to the bin folder (xxx\mechdlk_sdk\samples\csharp). -
Copy and paste the resources folder under the project folder to the path xxx\mechdlk_sdk\samples\csharp\bin.
-
Copy and paste all files in the 3rd_dll folder under the project folder to the path xxx\mechdlk_sdk\samples\csharp\bin.
Ensure that only the files in the 3rd_dll folder are copied and pasted to the destination path, not the folder itself. -
Copy and paste all files in the mechdlk_sdk\dll directory under the project folder to the path xxx\mechdlk_sdk\samples\csharp\bin.
Ensure that only the files in the mechdlk_sdk\dll folder are copied and pasted to the destination path, not the folder itself. -
In the directory OpenCvSharp, copy and paste the
OpenCvSharpExtern.dll
file in the directory of NativeLib\win\x64 to the path xxx\mechdlk_sdk\samples\csharp\bin.
To run any C# sample in Mech-DLK SDK, you only need to perform Steps 2, 3, and 4 once. |
After you complete the copy, the destination folder should contain the following types of files (the filenames may vary):