105 lines
4.8 KiB
C
Raw Normal View History

2025-12-10 00:01:32 +08:00
#ifndef TFTECH_EPICEYESDK_EPICEYE_H
#define TFTECH_EPICEYESDK_EPICEYE_H
#include "nlohmann_json.hpp"
#include <vector>
namespace TFTech {
struct EpicEyeInfo {
std::string SN; //序列号
std::string IP; //相机IP地址
std::string model; //相机的型号
std::string alias; //相机的别名,可通过Web UI进行更改
uint32_t width = 0; //图像的width
uint32_t height = 0; //图像的height
};
class EpicEye {
public:
static std::string getSDKVersion();
/**
* @brief
* @return bool,
* @param ip,std::string ip地址
* @param info, EpicEyeInfo ,widthheight
*/
static bool getInfo(std::string ip, EpicEyeInfo &info);
/**
* @brief FrameFrame可能同时包含
* 2D图像和点云数据frameID进行索引frameID
* getImage和getPointCloud方法将数据取回
* @return bool,
* @param ip,std::string ip地址
* @param frameID, std::string frameID
* @param pointCloud, bool falseFrame仅包含2D图像数据
*/
static bool triggerFrame(std::string ip, std::string &frameID, bool pointCloud = true);
/**
* @brief frameID获取2D图像, SDK使用者进行申请和释放
* @return bool,
* @param ip,std::string ip地址
* @param frameID, std::string frameIDtriggerFrame获得
* @param imageBuffer, void * ,
* imageBuffer的内存由SDK使用者进行申请和释放
*/
static bool getImage(std::string ip, std::string frameID, void *imageBuffer, int &pixelByteSize);
/**
* @brief frameID获取点云, SDK使用者进行申请和释放
* @return bool,
* @param ip,std::string ip地址
* @param frameID, std::string frameIDtriggerFrame获得
* @param pointCloudBuffer, void * ,
* pointCloudBuffer的内存由SDK使用者进行申请和释放,width*height*sizeof(float)*3
*/
static bool getPointCloud(std::string ip, std::string frameID, float *pointCloudBuffer);
/**
* @brief frameID获取深度圖, SDK使用者进行申请和释放
* @return bool,
* @param ip,std::string ip地址
* @param frameID, std::string frameIDtriggerFrame获得
* @param depth, void * ,
* depth的内存由SDK使用者进行申请和释放,width*height*sizeof(float)
*/
static bool getDepth(std::string ip, std::string frameID, float *depth);
/**
* @brief frameID获取相机参数配置frameID为空字符串""
* @return bool,
* @param ip,std::string ip地址
* @param configJson, nlohmann::json
* @param frameID, std::string frameIDtriggerFrame获得
*/
static bool getConfig(std::string ip, nlohmann::json &configJson);
/**
* @brief
* @return bool,
* @param ip,std::string ip地址
* @param configJson, nlohmann::json
*/
static bool setConfig(std::string ip, const nlohmann::json &configJson);
/**
* @brief 2D图像对应相机的相机矩阵
* @return bool,
* @param ip,std::string ip地址
* @param cameraMatrix, std::vector<float> 3x3的camera matrix
* OpenCV兼容
*/
static bool getCameraMatrix(std::string ip, std::vector<float> &cameraMatrix);
/**
* @brief 2D图像对应相机的畸变参数
* @return bool,
* @param ip,std::string ip地址
* @param distortion, std::vector<float> OpenCV兼容
*/
static bool getDistortion(std::string ip, std::vector<float> &distortion);
/**
* @brief
* @return bool,
* @param cameraList, EpicEyeInfo形式返回的搜索到的相机列表
*/
static bool searchCamera(std::vector<EpicEyeInfo> &cameraList);
};
} // namespace TFTech
#endif