323 lines
12 KiB
C
323 lines
12 KiB
C
#ifndef __VIZUM_UTILS_HEADER__
|
||
#define __VIZUM_UTILS_HEADER__
|
||
|
||
/*****************************************************************************
|
||
* Vizum Detect SDK Utils *
|
||
* Copyright (C) 2022 Vizum Technology. *
|
||
* *
|
||
* This file is part of VizumSDK. *
|
||
* * *
|
||
* *
|
||
* @file VZNL_Utils.h *
|
||
* @brief 包含部分图像生成的方式 *
|
||
* Details. *
|
||
* *
|
||
* @author Vizum *
|
||
* @email *
|
||
* @date 2022/07/03 *
|
||
* *
|
||
*----------------------------------------------------------------------------*
|
||
* Remark : Description *
|
||
*----------------------------------------------------------------------------*
|
||
* Change History : *
|
||
* <Date> | <Version> | <Author> | <Description> *
|
||
*----------------------------------------------------------------------------*
|
||
* 2022/07/03 | 3.6.17.10 | Vizum | 增加了2D图生成工具 *
|
||
*----------------------------------------------------------------------------*
|
||
* *
|
||
*****************************************************************************/
|
||
|
||
#include "VZNL_Export.h"
|
||
#include "VZNL_Types.h"
|
||
|
||
typedef struct
|
||
{
|
||
union {
|
||
struct
|
||
{
|
||
unsigned int bNoFirewallToken : 1; //< 是否有防火墙权限
|
||
unsigned int bNetWork100M : 1; //< 设备中含有 100M 网络
|
||
unsigned int bSameMACDevice : 1; //< 有相同MAC的设备
|
||
unsigned int bVLANError : 1; //< IP不在同网段
|
||
unsigned int bIsAdmin : 1; //< 是否管理员权限
|
||
unsigned int bOpenJumboFrame : 1; //< 是否开启了巨型帧
|
||
unsigned int bIPConflict : 1; //< 是否存在IP地址冲突
|
||
};
|
||
|
||
unsigned int nCheckMask; //< 当为0时表示都符合要求
|
||
};
|
||
unsigned int nHostNetCardCnt; //本机网卡数量
|
||
SVzNetCardInfo* sHostNetCard; //本机网卡列表
|
||
unsigned int nSameMACDeviceCnt; //有相同MAC的设备数量
|
||
SVzNLEyeCBInfo* sSameMACDevice; //相同MAC的设备IP列表
|
||
unsigned int nVLANErrorDeviceCnt; //IP不在同网段的设备数量
|
||
SVzNLEyeCBInfo* sVLANErrorDevice; //IP不在同网段的设备IP列表
|
||
unsigned int nIPConflictDeviceCnt; //IP地址冲突的设备数量
|
||
SVzNLEyeCBInfo* sIPConflictDevice; //IP地址冲突的设备IP列表
|
||
} SVzCheckPlatformInfo;
|
||
|
||
/**
|
||
* @brief 检测运行环境
|
||
* @param psPlatformInfo 环境信息
|
||
* @return 返回VzTrue说明一切正常,返回VzFalse表示有信息不匹配的地方
|
||
*/
|
||
VZNLAPI int VzNL_CheckPlatform(SVzCheckPlatformInfo* psPlatformInfo);
|
||
|
||
/// @name 静态相机图像生成工具集
|
||
/// @{
|
||
/**
|
||
* @brief 使用固定点云数据生成深度图
|
||
* @param eDataType 数据类型
|
||
* @param p3DPoint 3D点云数组
|
||
* @param nPointCount 点的个数
|
||
* @param sDepthMapParam 深度图参数
|
||
* @param ppImageData 图像
|
||
* @return 返回0表示正常
|
||
*/
|
||
VZNLAPI int VzNL_CreateDepthMapImage(EVzResultDataType eDataType, void* p3DPoint, unsigned int nPointCount, SVzDepthMapImgCtlPara* sDepthMapParam, SVzNLImageData** ppImageData);
|
||
|
||
/**
|
||
* @brief 使用固定点云生成灰度图
|
||
* @param eDataType 数据类型
|
||
* @param p3DPoint 3D点云数组
|
||
* @param nPointCount 点的个数
|
||
* @param fXYScale XY比例
|
||
* @param ppImageData 图像
|
||
* @return 返回0表示正常
|
||
*/
|
||
VZNLAPI int VzNL_CreateGrayImage(EVzResultDataType eDataType, void* p3DPoint, unsigned int nPointCount, float fXYScale, SVzNLImageData** ppImageData);
|
||
/// @}
|
||
|
||
/**
|
||
* @brief 读取图像
|
||
* @param szFileName [in] 要读取的文件全路径
|
||
* @param ppImageData [out] 无压缩图像实例
|
||
* @return 返回0表明正确
|
||
*/
|
||
VZNLAPI int VzNL_LoadImageFromFile(const char* szFileName, SVzNLImageData** ppImageData);
|
||
|
||
/**
|
||
* @brief 从tif文件中加载3D点云
|
||
* @param lpszFile 文件全路径
|
||
* @param nImageWidth 图像宽
|
||
* @param nImageHeight 图像高
|
||
* @param eDataType 数据类型
|
||
* @param p3DPoint 3D点指针
|
||
* @return 返回0表示正常
|
||
*/
|
||
VZNLAPI int VzNL_LoadDepthMapTiffImage(const char* lpszFile, unsigned int* nImageWidth, unsigned int* nImageHeight, SVzNL3DPointF* p3DPoint, unsigned int* nPointCount);
|
||
|
||
/**
|
||
* @brief 将3D点云数据存储为Tif深度图
|
||
* @param lpszFile 文件全路径
|
||
* @param nImageWidth 图像宽
|
||
* @param nImageHeight 图像高
|
||
* @param eDataType 数据类型
|
||
* @param p3DPoint 3D点指针
|
||
* @return 返回0表示正常
|
||
*/
|
||
VZNLAPI int VzNL_SaveDepthMapTiffImage(const char* lpszFile, unsigned int nImageWidth, unsigned int nImageHeight, EVzResultDataType eDataType, void* p3DPoint);
|
||
|
||
/// @name 点云后处理工具
|
||
/// @{
|
||
|
||
/**
|
||
* @brief 深度图图像回调
|
||
* @param pImageData 传出处理后的图像 [输出参数]
|
||
* @param pParam 回调传递的数据 [输出参数]
|
||
*/
|
||
typedef void(*VzNL_OnOutputCloudPointAPData)(const SVzNLImageData* psImageData, const SVz3DPointMapTable* psPointMapTable, void* pParam);
|
||
|
||
/**
|
||
* @brief 创建点云后处理工具Handle
|
||
* @return 返回深度图的句柄
|
||
*/
|
||
VZNLAPI VZNLPOINTCLOUDHANDLE VzNL_CreateCloudPointAPTool();
|
||
|
||
/**
|
||
* @brief 当配置自适应参数时,选择绑定设备Handle
|
||
*/
|
||
VZNLAPI int VzNL_AttachHandleForCloudPointAP(VZNLPOINTCLOUDHANDLE hCloudPointTool, VZNLHANDLE hDevice);
|
||
|
||
/**
|
||
* @brief 当配置自适应参数时,可以选择绑定检测工具Handle
|
||
*/
|
||
VZNLAPI int VzNL_AttachDetectToolForCloudPointAP(VZNLPOINTCLOUDHANDLE hCloudPointTool, VZNLDETECTHANDLE hDetectHandle);
|
||
|
||
/**
|
||
* @brief 当配置自适应参数时,绑定设备Handle
|
||
*/
|
||
VZNLAPI int VzNL_DetachHandleForCloudPointAP(VZNLPOINTCLOUDHANDLE hCloudPointTool);
|
||
|
||
/**
|
||
* @brief 设置3D点云基准激光线(当生成灰度/深度图时需要配置), 配置后内部的图像参数会进行改变,若查看参数信息请调用 VzNL_GetCloudPointAPParam
|
||
* @param hCloudPointTool 点云工具句柄
|
||
* @param p3DPosition 3D数据
|
||
* @param nPointCount 3D点的个数
|
||
*/
|
||
VZNLAPI int VzNL_SetCloudPointAPBaseLine(VZNLPOINTCLOUDHANDLE hCloudPointTool, SVzNL3DPosition* p3DPosition, unsigned int nPointCount);
|
||
|
||
/**
|
||
* @brief 设置深度图/灰度图配置参数(当生成灰度/深度图时需要配置)
|
||
* @param hCloudPointTool 点云工具句柄
|
||
* @param psDepthMapParam 深度图配置参数
|
||
*/
|
||
VZNLAPI int VzNL_SetCloudPointAPParam(VZNLPOINTCLOUDHANDLE hCloudPointTool, SVzDepthMapImgCtlPara* psDepthMapParam);
|
||
|
||
/**
|
||
* @brief 启用基准线深度值计算模式(当生成灰度/深度图时需要配置)
|
||
* @param hCloudPointTool 点云工具句柄
|
||
* @param bEnable VzTrue 启用 / VzFalse 禁用
|
||
* @note 基准线模式:bEnable = VzTrue 当深度计算需要用当前一条线作为高度基准时,配置为此模式,例如激光线照射U型皮带,会形成高低不等的一条激光线,这个时候
|
||
* U型皮带上的各个点均为自身位置的0点位置
|
||
*/
|
||
VZNLAPI int VzNL_EnableCloudPointAPBaseLineMode(VZNLPOINTCLOUDHANDLE hCloudPointTool, VzBool bEnable);
|
||
VZNLAPI VzBool VzNL_IsEnableCloudPointAPBaseLineMode(VZNLPOINTCLOUDHANDLE hCloudPointTool);
|
||
|
||
/**
|
||
* @brief 设置输出图像的最小宽度(当生成灰度 / 深度图时需要配置)
|
||
* @paramhCloudPointTool 点云工具句柄
|
||
* @paramnMinImageWidth 输出图像的最小宽度
|
||
*/
|
||
VZNLAPI int VzNL_SetCloudPointAPImageWidth(VZNLPOINTCLOUDHANDLE hCloudPointTool, unsigned int nMinImageWidth);
|
||
|
||
/**
|
||
* @brief 获取点云配置
|
||
* @paramhCloudPointTool 点云工具句柄
|
||
* @psDepthMapParam [out] 点云配置
|
||
*/
|
||
VZNLAPI int VzNL_GetCloudPointAPParam(VZNLPOINTCLOUDHANDLE hCloudPointTool, SVzDepthMapImgCtlPara* psDepthMapParam);
|
||
|
||
/**
|
||
* @brief 获取输出图像的最小宽度(当生成灰度 / 深度图时需要配置)
|
||
* @paramhCloudPointTool 点云工具句柄
|
||
* @pnImageHeight [out] 输出图像高度
|
||
*/
|
||
VZNLAPI int VzNL_GetCloudPointAPImageHeight(VZNLPOINTCLOUDHANDLE hCloudPointTool, int* pnImageHeight);
|
||
|
||
/**
|
||
* @brief 开始点云处理(目前仅支持 keResultDataType_Position)
|
||
* @param hCloudPointTool 点云工具句柄
|
||
* @param eAfterProcType 图像后处理类型 kePointAfterProcType_DepthMap(深度图) kePointAfterProcType_GrayPic(灰度图)
|
||
* @param eDataType 激光线数据 SVzLaserLineData 的数据类型
|
||
* @param eDirect 激光线扫描方向
|
||
* @param pDepthMap 深度图的回调
|
||
* @param pParam 回调函数的参数
|
||
* @return 返回0则为正确,返回非0为错误,可通过VzNL_GetErrorInfo 获取错误信息
|
||
*/
|
||
VZNLAPI int VzNL_BeginCloudPointAfterProc(VZNLPOINTCLOUDHANDLE hCloudPointTool, EVzPointAfterProcType eAfterProcType, EVzResultDataType eDataType, EVzObjRunDirect eDirect, VzNL_OnOutputCloudPointAPData pDepthMap, void* pParam);
|
||
|
||
/**
|
||
* @brief 点云处理(目前仅支持 keResultDataType_Position)
|
||
* @param hCloudPointTool 点云工具句柄
|
||
* @param psLineData 激光线数据
|
||
*/
|
||
VZNLAPI int VzNL_CloudPointAfterProc(VZNLPOINTCLOUDHANDLE hCloudPointTool, SVzLaserLineData* psLineData);
|
||
|
||
/**
|
||
* @brief 结束点云处理
|
||
* @param hCloudPointTool 点云工具句柄
|
||
*/
|
||
VZNLAPI int VzNL_EndCloudPointAfterProc(VZNLPOINTCLOUDHANDLE hCloudPointTool);
|
||
|
||
/**
|
||
* @brief 销毁点云处理工具
|
||
* @param hCloudPointTool 点云工具句柄
|
||
*/
|
||
VZNLAPI int VzNL_DestroyCloudPointAPTool(VZNLPOINTCLOUDHANDLE hCloudPointTool);
|
||
/// @}
|
||
|
||
/// @name 图像生成工具
|
||
/// @{
|
||
|
||
/**
|
||
* @brief 创建图像生成工具
|
||
* @param hDevice 设备句柄
|
||
*/
|
||
VZNLAPI VZNLIMAGEGENERATOR VzNL_CreateImageGenerator(VZNLHANDLE hDevice);
|
||
|
||
/**
|
||
* @brief 开始送入点云数据
|
||
* @param hImageGenerator 图像生成工具
|
||
* @param eDataType 送入数据的类型,目前仅支持 keResultDataType_PointXYZRGBA 与 keResultDataType_PointGray
|
||
* keResultDataType_PointGray 输出图像为 8 bit 灰度图
|
||
* keResultDataType_PointGray 输出图像为 24 bit 彩色图
|
||
*/
|
||
VZNLAPI int VzNL_BeginPushPointToImageGenerator(VZNLIMAGEGENERATOR hImageGenerator, EVzResultDataType eDataType);
|
||
|
||
/**
|
||
* @brief 送入点云数据进行处理
|
||
* @param hImageGenerator 图像生成工具
|
||
* @param psLineData 激光线数据
|
||
*/
|
||
VZNLAPI int VzNL_PushPointToImageGenerator(VZNLIMAGEGENERATOR hImageGenerator, SVzLaserLineData* psLineData);
|
||
|
||
/**
|
||
* @brief 结束点云传送
|
||
* @param hImageGenerator 图像生成工具
|
||
*/
|
||
VZNLAPI int VzNL_EndPushPointToImageGenerator(VZNLIMAGEGENERATOR hImageGenerator);
|
||
|
||
/**
|
||
* @brief 通过图像生成工具,生成图像
|
||
* @param hImageGenerator 图像生成工具
|
||
* @param psLineData 图像数据
|
||
*/
|
||
VZNLAPI int VzNL_GetImageFromImageGenerator(VZNLIMAGEGENERATOR hImageGenerator, SVzNLImageData** ppImageData);
|
||
|
||
/**
|
||
* @brief 通过图像生成工具,生成图像
|
||
* @param hImageGenerator 图像生成工具
|
||
* @param lpszFile 文件名 tif
|
||
*/
|
||
VZNLAPI int VzNL_SaveDepthMapImageFromImageGenerator(VZNLIMAGEGENERATOR hImageGenerator, const char* lpszFile);
|
||
|
||
/**
|
||
* @brief 通过2D位置找3D点
|
||
* @param hImageGenerator 图像生成工具
|
||
* @param psLineData 3D数据
|
||
*/
|
||
VZNLAPI int VzNL_Find3DPointFrom2DPosForImageGenerator(VZNLIMAGEGENERATOR hImageGenerator, int nX, int nY, SVzNLPointXYZ* p3DPoint);
|
||
|
||
/**
|
||
* @brief 销毁图像创建工具
|
||
* @param hImageGenerator 图像生成工具
|
||
*/
|
||
VZNLAPI int VzNL_DestroyImageGenerator(VZNLIMAGEGENERATOR hImageGenerator);
|
||
|
||
/// @}
|
||
|
||
/// @name 多系统相关函数
|
||
/// @{
|
||
/**
|
||
* @brief 获取当前系统列表
|
||
* @param hDevice 设备Handle
|
||
* @param pnCount 输出系统的个数
|
||
* @return 系统列表数组
|
||
*/
|
||
VZNLAPI SVzSystemProjectInfo* VzNL_GetSystemPrjArray(VZNLHANDLE hDevice, int* pnCount);
|
||
|
||
/**
|
||
* @brief 设置当前系统索引
|
||
* @param hDevice 设备Handle
|
||
* @param nCurSel 要配置为第几个系统为运行时的系统
|
||
* @return 返回0为正确,其他错误码请用GetErrorString。
|
||
*/
|
||
VZNLAPI int VzNL_SwitchSystemPrj(VZNLHANDLE hDevice, int nCurSel);
|
||
|
||
/**
|
||
* @brief 获取当前系统索引
|
||
* @param hDevice 设备Handle
|
||
* @return 当前系统的索引
|
||
*/
|
||
VZNLAPI int VzNL_GetCurrentSystemPrj(VZNLHANDLE hDevice);
|
||
|
||
/**
|
||
* @brief 查询运行时间(s)
|
||
* @param hDevice 设备Handle
|
||
* @param pnErrorCode 错误码
|
||
* @return 返回运行时间
|
||
*/
|
||
VZNLAPI double VzNL_GetSystemRuntime(VZNLHANDLE hDevice, int* pnErrorCode);
|
||
/// @}
|
||
#endif |