|
LoadDLL.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using HalconDotNet;
- using System.Runtime.InteropServices;
- namespace CED_CSharp
- {
- class LoadDLL
- {
- // DLL名称
- const string AlgorithmName = "CED.dll";
- [DllImport(AlgorithmName, EntryPoint = "SetLogPath")]
- public static extern void SetLogPath(string path);
- [DllImport(AlgorithmName, EntryPoint = "SetRootDir")]
- public static extern void SetRootDir(string dir);
- [DllImport(AlgorithmName, EntryPoint = "InitLoadDLL")]
- public static extern void InitLoadDLL();
- [DllImport(AlgorithmName, EntryPoint = "CED_LoG_Bridge", CallingConvention = CallingConvention.Cdecl )]
- private static extern bool CED_LoG_Bridge(long ho_Image, out long ho_ImageCED, out long ho_DiffOfGauss, long hv_Sigma1, long hv_Sigma2);
- public static bool CED_LoG(HObject ho_Image, out HObject ho_ImageCED, out HObject ho_DiffOfGauss, HTuple hv_Sigma1, HTuple hv_Sigma2)
- {
- HTuple image, sigma1, sigma2;
- long imageCED, imageLoG;
- HOperatorSet.SerializeObject(ho_Image, out image);
- HOperatorSet.SerializeTuple(hv_Sigma1, out sigma1);
- HOperatorSet.SerializeTuple(hv_Sigma2, out sigma2);
- if (CED_LoG_Bridge(image, out imageCED, out imageLoG, sigma1, sigma2))
- {
- HOperatorSet.DeserializeObject(out ho_ImageCED, imageCED);
- HOperatorSet.DeserializeObject(out ho_DiffOfGauss, imageLoG);
- return true;
- }
- else
- {
- HOperatorSet.GenEmptyObj(out ho_ImageCED);
- HOperatorSet.GenEmptyObj(out ho_DiffOfGauss);
- return false;
- }
- }
- }
- }
复制代码 |
|