using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace LB_SmartVisionCameraSDK.PHM6000 { /// /// 标定类 /// public class SysCalibration { //SYS_CALIBRATION_API(void*) CreateSysCalibrationEntry(); /// ///创建系统标定与测量模块实例,返回其句柄 /// /// 返回其句柄 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CreateSysCalibrationEntry")] public static extern IntPtr CreateSysCalibrationEntry(); //SYS_CALIBRATION_API(void) DestroySysCalibrationEntry(void* pHandle); /// /// 销毁系统标定与测量模块实例 /// [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DestroySysCalibrationEntry")] public static extern void DestroySysCalibrationEntry(); //SYS_CALIBRATION_API(void) SetSensorInfo(void* pHandle, int nSensorIndex, SENSOR_INFO stInfo); /// /// 设置传感器信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 传感器信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetSensorInfo")] public static extern void SetSensorInfo(IntPtr pHandle, int nSensorIndex, SENSOR_INFO stInfo); //SYS_CALIBRATION_API(void) GetSensorInfo(void* pHandle, int nSensorIndex, SENSOR_INFO& stInfo); /// /// 获取传感器信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回传感器信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetSensorInfo")] public static extern void GetSensorInfo(IntPtr pHandle, int nSensorIndex, ref SENSOR_INFO stInfo); //SYS_CALIBRATION_API(void) SetActiveAreaInfo(void* pHandle, int nSensorIndex, ACTIVE_AREA_INFO stInfo); /// /// 设置活动区信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 活动区信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetActiveAreaInfo")] public static extern void SetActiveAreaInfo(IntPtr pHandle, int nSensorIndex, ACTIVE_AREA_INFO stInfo); //SYS_CALIBRATION_API(void) GetActiveAreaInfo(void* pHandle, int nSensorIndex, ACTIVE_AREA_INFO& stInfo); /// /// 获取活动区信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回活动区信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetActiveAreaInfo")] public static extern void GetActiveAreaInfo(IntPtr pHandle, int nSensorIndex, ref ACTIVE_AREA_INFO stInfo); //SYS_CALIBRATION_API(void) SetTransInfo(void* pHandle, int nSensorIndex, TRANS_INFO stInfo); /// /// 设置坐标系转换信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 坐标系转换信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetTransInfo")] public static extern void SetTransInfo(IntPtr pHandle, int nSensorIndex, TRANS_INFO stInfo); //SYS_CALIBRATION_API(void) GetTransInfo(void* pHandle, int nSensorIndex, TRANS_INFO& stInfo); /// /// 获取坐标系转换信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回坐标系转换信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetTransInfo")] public static extern void GetTransInfo(IntPtr pHandle, int nSensorIndex, ref TRANS_INFO stInfo); //SYS_CALIBRATION_API(void) SetSensorPosition(void* pHandle, int nSensorIndex, SENSOR_POSITION stPosition); /// /// 设置传感器位置信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 传感器位置信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetSensorPosition")] public static extern void SetSensorPosition(IntPtr pHandle, int nSensorIndex, SENSOR_POSITION stPosition); //SYS_CALIBRATION_API(void) GetSensorPosition(void* pHandle, int nSensorIndex, SENSOR_POSITION* stPosition); /// /// 获取传感器位置信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回传感器位置信息, SENSOR_POSITION* stPosition [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetSensorPosition")] public static extern void GetSensorPosition(IntPtr pHandle, int nSensorIndex, IntPtr stPosition); //SYS_CALIBRATION_API(void) CalcTransInfo(void* pHandle, int nTotal); /// /// 计算坐标系转换信息,无返回值,此函数不用 /// /// 系统标定与测量模块句柄 /// 传感器数量 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CalcTransInfo")] public static extern void CalcTransInfo(IntPtr pHandle, int nTotal); //SYS_CALIBRATION_API(void) GetTransInfoPtr(void* pHandle, int nSensorIndex, TRANS_INFO* stInfo); /// /// 获取坐标系转换信息,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回坐标系转换信息结构体的指针, TRANS_INFO* stInfo [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetTransInfoPtr")] public static extern void GetTransInfoPtr(IntPtr pHandle, int nSensorIndex, IntPtr stInfo); //SYS_CALIBRATION_API(void) SetBoardParameter(void* pHandle, PARAM_BOARD stBoardParam); /// /// 设置标定物信息,无返回值 /// /// 系统标定与测量模块句柄 /// 标定物信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetBoardParameter")] public static extern void SetBoardParameter(IntPtr pHandle, PARAM_BOARD stBoardParam); //SYS_CALIBRATION_API(void) SetTargetParameter(void* pHandle, TARGET_INFO stTargetInfo); /// /// 设置被测物信息,无返回值 /// /// 系统标定与测量模块句柄 /// 被测物信息 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetTargetParameter")] public static extern void SetTargetParameter(IntPtr pHandle, TARGET_INFO stTargetInfo); //SYS_CALIBRATION_API(void) SetRate(void* pHandle, int nSensorIndex, float xRate, float yRate); /// /// 设置x和y坐标转换比例,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// x向转换比例 /// y向转换比例 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetRate")] public static extern void SetRate(IntPtr pHandle, int nSensorIndex, float xRate, float yRate); //SYS_CALIBRATION_API(void) SetHoleROI(void* pHandle, int nSensorIndex, int nIndex, LB_ROI stRoi, bool IsFloatValue); /// /// 设置圆孔兴趣区,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 孔序号 /// 圆孔兴趣区 /// 数值是否为浮点数 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetHoleROI")] public static extern void SetHoleROI(IntPtr pHandle, int nSensorIndex, int nIndex, LB_ROI stRoi, bool IsFloatValue); //SYS_CALIBRATION_API(void) SetFlatROI(void* pHandle, int nSensorIndex, LB_ROI stRoi, bool IsFloatValue); /// /// 设置平面兴趣区,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 平面兴趣区 /// 数值是否为浮点数 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetFlatROI")] public static extern void SetFlatROI(IntPtr pHandle, int nSensorIndex, LB_ROI stRoi, bool IsFloatValue); //SYS_CALIBRATION_API(void) SetLineROI(void* pHandle, int nSensorIndex, LB_ROI stRoi, bool IsFloatValue); /// /// 设置直线兴趣区,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 直线兴趣区 /// 数值是否为浮点数 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetLineROI")] public static extern void SetLineROI(IntPtr pHandle, int nSensorIndex, LB_ROI stRoi, bool IsFloatValue); //SYS_CALIBRATION_API(void) SetTestROI(void* pHandle, int nSensorIndex, LB_ROI stRoi, bool IsFloatValue); /// /// 设置测量兴趣区,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 测量兴趣区 /// 数值是否为浮点数 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetTestROI")] public static extern void SetTestROI(IntPtr pHandle, int nSensorIndex, LB_ROI stRoi, bool IsFloatValue); //SYS_CALIBRATION_API(void) RemovePointsRatio(void* pHandle, int nSensorIndex, float fRatio); /// /// 设置剔除数据个数的比例,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 剔除数据个数的比例 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "RemovePointsRatio")] public static extern void RemovePointsRatio(IntPtr pHandle, int nSensorIndex, float fRatio); //SYS_CALIBRATION_API(void) GetLineROI(void* pHandle, int nSensorIndex, LB_ROI* stRoi); /// /// 获得直线兴趣区,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回直线兴趣区 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetLineROI")] public static extern void GetLineROI(IntPtr pHandle, int nSensorIndex, IntPtr stRoi); //SYS_CALIBRATION_API(void) SetSysSensors(void* pHandle, int nCount); /// /// 设置系统中传感器的数量,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器数量 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetSysSensors")] public static extern void SetSysSensors(IntPtr pHandle, int nCount); //SYS_CALIBRATION_API(void) SetLineData(void* pHandle, int nSensorIndex, LBLineDataXYZ* pData); /// /// 设置行数据,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 含XYZ信息的行数据, LBLineDataXYZ* pData [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetSysSensors")] public static extern void SetSysSensors(IntPtr pHandle, int nSensorIndex, IntPtr pData); //SYS_CALIBRATION_API(void) AddLineData(void* pHandle, int nSensorIndex, LBLineDataXYZ* pData); /// /// 添加行数据,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 含XYZ信息的行数据, LBLineDataXYZ* pData [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AddLineData")] public static extern void AddLineData(IntPtr pHandle, int nSensorIndex, IntPtr pData); //SYS_CALIBRATION_API(void) ClearData(void* pHandle, int nSensorIndex); /// /// 清除数据,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "ClearData")] public static extern void ClearData(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(void) SetLineDataArray(void* pHandle, int nSensorIndex, LBLineDataZA* pData); /// /// 设置行数据,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 含XYZ信息的行数据, LBLineDataZA* pData [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetLineDataArray")] public static extern void SetLineDataArray(IntPtr pHandle, int nSensorIndex, IntPtr pData); //SYS_CALIBRATION_API(void) AddLineDataArray(void* pHandle, int nSensorIndex, LBLineDataZA* pData, bool bUseEncoder, int nCountingMode); /// /// 添加行数据,无返回值 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 含XYZ信息的行数据, LBLineDataZA* pData /// 是否使用编码器 /// 计数模式,建议值为1 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AddLineDataArray")] public static extern void AddLineDataArray(IntPtr pHandle, int nSensorIndex, IntPtr pData, bool bUseEncoder, int nCountingMode); //SYS_CALIBRATION_API(LBLineDataXYZ*) GetLineData(void* pHandle, int nSensorIndex); /// /// 获取行数据 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回含XYZ信息的行数据,(LBLineDataXYZ*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetLineData")] public static extern IntPtr GetLineData(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(LBPointCloudData*) GetCloudData(void* pHandle, int nSensorIndex); /// /// 获取点云数据 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回点云数据,(LBPointCloudData*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCloudData")] public static extern IntPtr GetCloudData(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(LBPointCloudDataXYZ*) GetCloudDataXYZ(void* pHandle, int nSensorIndex, int nDownsample); /// /// 获取点云数据 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 降采样倍数 /// 返回含XYZ信息的点云数据,(LBPointCloudDataXYZ*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCloudDataXYZ")] public static extern IntPtr GetCloudDataXYZ(IntPtr pHandle, int nSensorIndex, int nDownsample); //SYS_CALIBRATION_API(LBPointCloudDataXYZ*) GetFlatDataXYZ(void* pHandle, int nSensorIndex, int nDownsample, float fThreshold); /// /// 获取平面点云数据 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 降采样倍数 /// 与平面的偏差域值 /// 返回含XYZ信息的平面点云数据,(LBPointCloudDataXYZ*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetFlatDataXYZ")] public static extern IntPtr GetFlatDataXYZ(IntPtr pHandle, int nSensorIndex, int nDownsample, float fThreshold); //SYS_CALIBRATION_API(bool) AlignmentMovingFlat(void* pHandle, int nSensorIndex); /// /// 移动平面型校准 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AlignmentMovingFlat")] public static extern bool AlignmentMovingFlat(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(bool) AlignmentFlatSurface(void* pHandle, int nSensorIndex, int nType); /// /// 平面型校准 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 类型,未使用 /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AlignmentFlatSurface")] public static extern bool AlignmentFlatSurface(IntPtr pHandle, int nSensorIndex, int nType); //SYS_CALIBRATION_API(bool) AlignmentBar(void* pHandle, int nSensorIndex, int nType, PARAM_BAR stBarInfo); /// /// 条状物型校准 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 类型(移动型或固定型) /// 条状物信息 /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AlignmentBar")] public static extern bool AlignmentBar(IntPtr pHandle, int nSensorIndex, int nType, PARAM_BAR stBarInfo); //SYS_CALIBRATION_API(bool) AlignmentPolygon(void* pHandle, int nSensorIndex, int nType, PARAM_POLYGON stInfo); /// /// 多边形型校准 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 类型(移动型或固定型) /// 多边形信息 /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AlignmentPolygon")] public static extern bool AlignmentPolygon(IntPtr pHandle, int nSensorIndex, int nType, PARAM_POLYGON stInfo); //SYS_CALIBRATION_API(bool) PointsRotationAndTranslation(void* pHandle, int nSensorIndex, LBLineDataXYZ Input, LBLineDataXYZ Output); /// /// 点集先旋转再平移函数 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 输入点集 /// 输出点集 /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsRotationAndTranslation")] public static extern bool PointsRotationAndTranslation(IntPtr pHandle, int nSensorIndex, LBLineDataXYZ Input, LBLineDataXYZ Output); //SYS_CALIBRATION_API(bool) PointsResampling(void* pHandle, LBCalibrationData Input, LBCalibrationData Output); /// /// 点集重采样函数 /// /// 系统标定与测量模块句柄 /// 输入点集 /// 输出点集 /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsResampling")] public static extern bool PointsResampling(IntPtr pHandle, LBCalibrationData Input, LBCalibrationData Output); //SYS_CALIBRATION_API(bool) PointsRotationAndTranslation2D(void* pHandle, int nSensorIndex, LBLineDataXYZ* pInput, LBLineDataXYZ* pOutput); /// /// 二维点集先旋转再平移函数 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 输入点集, LBLineDataXYZ* pInput /// 输出点集, LBLineDataXYZ* pOutput /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsRotationAndTranslation2D")] public static extern bool PointsRotationAndTranslation2D(IntPtr pHandle, int nSensorIndex, IntPtr pInput, IntPtr pOutput); //SYS_CALIBRATION_API(bool) PointsTranslationAndRotation2D(void* pHandle, int nSensorIndex, LBLineDataXYZ* pInput, LBLineDataXYZ* pOutput); /// /// 二维点集先平移再旋转函数 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 输入点集, LBLineDataXYZ* pInput /// 输出点集, LBLineDataXYZ* pOutput /// 设置失败返回false,否则返回true。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsTranslationAndRotation2D")] public static extern bool PointsTranslationAndRotation2D(IntPtr pHandle, int nSensorIndex, IntPtr pInput, IntPtr pOutput); //SYS_CALIBRATION_API(LBLineDataXZ*) GetInlierDataXZ(void* pHandle); /// /// 获取含XZ信息的内点数据 /// /// 系统标定与测量模块句柄 /// 返回含XZ信息的内点数据,(LBLineDataXZ*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetInlierDataXZ")] public static extern IntPtr GetInlierDataXZ(IntPtr pHandle); //SYS_CALIBRATION_API(LBPointCloudDataXYZ*) GetInlierDataXYZ(void* pHandle); /// /// 获取含XYZ信息的内点数据 /// /// 系统标定与测量模块句柄 /// 返回含XYZ信息的内点数据,(LBPointCloudDataXYZ*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetInlierDataXYZ")] public static extern IntPtr GetInlierDataXYZ(IntPtr pHandle); //SYS_CALIBRATION_API(LBPointCloudDataXYZ*) GetSourceDataXYZ(void* pHandle); /// /// 获取含XYZ信息的源点数据 /// /// 系统标定与测量模块句柄 /// 返回含XYZ信息的源点数据,(LBPointCloudDataXYZ*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetSourceDataXYZ")] public static extern IntPtr GetSourceDataXYZ(IntPtr pHandle); //SYS_CALIBRATION_API(void) GetLineParameter(void* pHandle, double& k, double& b); /// /// 获取直线参数,无返回 /// /// 系统标定与测量模块句柄 /// 斜率 /// 截距 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetLineParameter")] public static extern void GetLineParameter(IntPtr pHandle, ref double k, ref double b); //SYS_CALIBRATION_API(void) GetFlatParameter(void* pHandle, int nSensorIndex, double& A, double& B, double &C, double &D); /// /// 获取平面参数,无返回 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// x分量 /// y分量 /// z分量 /// 截距 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetFlatParameter")] public static extern void GetFlatParameter(IntPtr pHandle, int nSensorIndex, ref double A, ref double B, ref double C, ref double D); //SYS_CALIBRATION_API(void) GetCircleParameter(void* pHandle, int nSensorIndex, int nIndex, double& x, double& y, double &r); /// /// 获取圆参数,无返回 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 圆的索引 /// x坐标 /// y坐标 /// 半径 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCircleParameter")] public static extern void GetCircleParameter(IntPtr pHandle, int nSensorIndex, int nIndex, ref double x, ref double y, ref double r); //SYS_CALIBRATION_API(void) GetLineParam(void* pHandle, double* k, double* b); /// /// 获取直线参数,无返回 /// /// 系统标定与测量模块句柄 /// 斜率 /// 截距 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetLineParam")] public static extern void GetLineParam(IntPtr pHandle, ref double k, ref double b); //SYS_CALIBRATION_API(void) GetLineParamInfo(void* pHandle, char* szParamInfo); /// /// 获取直线参数信息,无返回 /// /// 系统标定与测量模块句柄 /// 直线用文字表达的信息, char* szParamInfo [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetLineParamInfo")] public static extern void GetLineParamInfo(IntPtr pHandle, IntPtr szParamInfo); //SYS_CALIBRATION_API(void) GetLineModel(void* pHandle, double* cos_theta, double* sin_theta, double* rho); /// /// 获取直线的模型参数,无返回 /// /// 系统标定与测量模块句柄 /// 角余弦值 /// 角正弦值 /// 模长 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetLineModel")] public static extern void GetLineModel(IntPtr pHandle, ref double cos_theta, ref double sin_theta, ref double rho); //SYS_CALIBRATION_API(void) ConvertZA2XYZ(void* pHandle, LBLineDataZA* Input, LBLineDataXYZ* Output, bool bUseEncoder, int nCountingMode, int nDownSample); /// /// 转换ZA格式数据到XYZ格式数据,无返回 /// /// 系统标定与测量模块句柄 /// 输入数据指针, LBLineDataZA* Input /// 输出数据指针, LBLineDataXYZ* Output /// 是否使用编码器 /// 计数模式 /// 降采样倍率 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "ConvertZA2XYZ")] public static extern void ConvertZA2XYZ(IntPtr pHandle, IntPtr Input, IntPtr Output, bool bUseEncoder, int nCountingMode, int nDownSample); //SYS_CALIBRATION_API(int) CvtZA2XYZ(void* pHandle, LBLineDataZA* Input, float* x, float* y, float* z, bool bUseEncoder, int nCountingMode, int nDownSample); /// /// 转换XYZ格式数据到ZA格式数据 /// /// 系统标定与测量模块句柄 /// 输入数据指针, LBLineDataZA* Input /// x数据指针, float* x /// y数据指针, float* y /// z数据指针, float* z /// 是否使用编码器 /// 计数模式 /// 降采样倍率 /// 返回转换后的数据数量 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CvtZA2XYZ")] public static extern int CvtZA2XYZ(IntPtr pHandle, IntPtr Input, IntPtr x, IntPtr y, IntPtr z, bool bUseEncoder, int nCountingMode, int nDownSample); //SYS_CALIBRATION_API(int) SetOffsetInfo(void* pHandle, int nSensorIndex, OFFSET_INFO stInfo); /// /// 设置行数据 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 偏移信息 /// 返回值0表示失败,1表是成功 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SetOffsetInfo")] public static extern int SetOffsetInfo(IntPtr pHandle, int nSensorIndex, OFFSET_INFO stInfo); //SYS_CALIBRATION_API(int) PointsRotateAndTrans2D(void* pHandle, int nSensorIndex, LBLineDataXYZ* pInput, LBLineDataXYZ* pOutput, int RemoveNAN); /// /// 二维点集先旋转再平移函数 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 输入点集, LBLineDataXYZ* pInput /// 输出点集, LBLineDataXYZ* pOutput /// 是否删除NAN,1删除,0保留 /// 设置失败返回0,否则返回1。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsRotateAndTrans2D")] public static extern int PointsRotateAndTrans2D(IntPtr pHandle, int nSensorIndex, IntPtr pInput, IntPtr pOutput, int RemoveNAN); //SYS_CALIBRATION_API(int) PointsRotateAndMove2D(void* pHandle, int nSensorIndex, LBPointXYZ* pInput, LBPointXYZ* pOutput, int nInputSize, int RemoveNAN); /// /// 二维点集先旋转再平移函数,与上面的一个函数输入输出不同 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 输入点集, LBPointXYZ* pInput /// 输出点集, LBPointXYZ* pOutput /// 输入数据集的大小 /// 是否删除NAN,1删除,0保留 /// 设置失败返回0,否则返回1。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsRotateAndMove2D")] public static extern int PointsRotateAndMove2D(IntPtr pHandle, int nSensorIndex, IntPtr pInput, IntPtr pOutput, int nInputSize, int RemoveNAN); //SYS_CALIBRATION_API(int) PointsRotateAroundPt2D(void* pHandle, LBLineDataXYZ* pInput, LBLineDataXYZ* pOutput, LBPointXZ pt, float theta, int IsOpposite); /// /// 二维点集绕点旋转 /// /// 系统标定与测量模块句柄 /// 输入点集, LBLineDataXYZ* pInput /// 输出点集, LBLineDataXYZ* pOutput /// 要绕的点 /// 要转的弧度 /// 是否相对安装 /// 设置失败返回0,否则返回1。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsRotateAroundPt2D")] public static extern int PointsRotateAroundPt2D(IntPtr pHandle, IntPtr pInput, IntPtr pOutput, LBPointXZ pt, float theta, int IsOpposite); //SYS_CALIBRATION_API(int) PointsMove2D(void* pHandle, LBLineDataXYZ* pInput, LBLineDataXYZ* pOutput, const float fDeltaX, const float fDeltaZ); /// /// 二维点集平移 /// /// 系统标定与测量模块句柄 /// 输入点集, LBLineDataXYZ* pInput /// 输出点集, LBLineDataXYZ* pOutput /// x偏移量 /// y偏移量 /// 设置失败返回0,否则返回1。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsMove2D")] public static extern int PointsMove2D(IntPtr pHandle, IntPtr pInput, IntPtr pOutput, float fDeltaX, float fDeltaZ); //SYS_CALIBRATION_API(int) PointsMerge(void* pHandle, LBPointXYZ* pInput1, int nCount1, LBPointXYZ* pInput2, int nCount2, LBPointXYZ* pOutput, int nSize); /// /// 两组三维点集合并函数 /// /// 系统标定与测量模块句柄 /// 输入点集1, LBPointXYZ* pInput1 /// 输入点集1的数量 /// 输入点集2, LBPointXYZ* pInput2 /// 输入点集2的数量 /// 输出点集, LBPointXYZ* pOutput /// 输出点集数量 /// 返回合并后的点集大小。 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "PointsMerge")] public static extern int PointsMerge(IntPtr pHandle, IntPtr pInput1, int nCount1, IntPtr pInput2, int nCount2, IntPtr pOutput, int nSize); //SYS_CALIBRATION_API(void) CalibratePointCloud(void* pHandle, int nSensorIndex); /// /// 校准点云,无返回值 /// /// 系统标定与测量模块句柄 /// [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CalibratePointCloud")] public static extern void CalibratePointCloud(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(void) SystemCalibration(void* pHandle); /// /// 系统标定,无返回值 /// /// 系统标定与测量模块句柄 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "SystemCalibration")] public static extern void SystemCalibration(IntPtr pHandle); //SYS_CALIBRATION_API(float) MeasureDistance(void* pHandle); /// /// 测量距离,不使用 /// /// 系统标定与测量模块句柄 /// 返回被测距离 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MeasureDistance")] public static extern float MeasureDistance(IntPtr pHandle); //SYS_CALIBRATION_API(float) MeasureMaxDistance(void* pHandle); /// /// 测量最大距离,不使用 /// /// 系统标定与测量模块句柄 /// 返回被测最大距离 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MeasureMaxDistance")] public static extern float MeasureMaxDistance(IntPtr pHandle); //SYS_CALIBRATION_API(float) ComputeConcavity(void* pHandle, int nSensorIndex); /// /// 计算凹凸度,不使用 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回凹凸度值 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "ComputeConcavity")] public static extern float ComputeConcavity(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(float) MeasureFlatHigh(void* pHandle, int nSensorIndex, LB_ROI stRoi); /// /// 测量平面高度,不使用 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 指定的兴趣区 /// 返回被测距平面的高度 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MeasureFlatHigh")] public static extern float MeasureFlatHigh(IntPtr pHandle, int nSensorIndex, LB_ROI stRoi); //SYS_CALIBRATION_API(float) MeasureTargetHigh(void* pHandle, int nSensorIndex); /// /// 测量目标物高度 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回被测目标物的高度 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MeasureTargetHigh")] public static extern float MeasureTargetHigh(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(float) MeasureRoiHigh(void* pHandle, int nSensorIndex, int nRoiIndex); /// /// 测量兴趣区物高度 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 兴趣区的索号,值从1起 /// 返回被测兴趣区的高度 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MeasureRoiHigh")] public static extern float MeasureRoiHigh(IntPtr pHandle, int nSensorIndex, int nRoiIndex); //SYS_CALIBRATION_API(float) MeasureLineHigh(void* pHandle, int nSensorIndex); /// /// 测量轮廓线高度 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回被测轮廓线的高度 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MeasureLineHigh")] public static extern float MeasureLineHigh(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(void) EdgeDetection(void* pHandle, int nSensorIndex); /// /// 边缘检测,无返回,不使用 /// /// 系统标定与测量模块句柄 /// 传感器序号 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "EdgeDetection")] public static extern void EdgeDetection(IntPtr pHandle, int nSensorIndex); //SYS_CALIBRATION_API(float) CalcIntercept(void* pHandle, int nSensorIndex, float& theta); /// /// 计算若干相近的轮廓线拟合直线与Y轴的交点,不使用 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 返回夹角 /// 返回Y轴上的截距 [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CalcIntercept")] public static extern float CalcIntercept(IntPtr pHandle, int nSensorIndex, ref float theta); //SYS_CALIBRATION_API(LBColorMap*) GetDepthMap(void* pHandle, int nSensorIndex, int nOption); /// /// 获取深度图 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 用4来获取大兴趣的深度图 /// 返回深度图结构体,(LBColorMap*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetDepthMap")] public static extern IntPtr GetDepthMap(IntPtr pHandle, int nSensorIndex, int nOption); //SYS_CALIBRATION_API(LBColorMap*) GetBinaryMap(void* pHandle, int nSensorIndex, int nOption); /// /// 获取黑白图,不使用 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 选项 /// 返回黑白图结构体,(LBColorMap*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetBinaryMap")] public static extern IntPtr GetBinaryMap(IntPtr pHandle, int nSensorIndex, int nOption); //SYS_CALIBRATION_API(LBColorMap*) GetResultMap(void* pHandle, int nSensorIndex, int nOption); /// /// 获取结果图,仅调试使用,不对外开放 /// /// 系统标定与测量模块句柄 /// 传感器序号 /// 选项 /// 返回结果图结构体,(LBColorMap*) [DllImport("SysCalibration.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetResultMap")] public static extern IntPtr GetResultMap(IntPtr pHandle, int nSensorIndex, int nOption); } }