// Author: NiuJiuRu // Email: niujiuru@qq.com // Date: 2025-07-21 #ifndef __TAKEPHOTO_H__ #define __TAKEPHOTO_H__ #include "./include/MvCameraControl.h" #include "../swapi/include_swapiLib.h" // 图像水印 typedef struct { char camModelName[MAX_LINE_CHARS]; // 相机型号名 char camSerialNum[MAX_LINE_CHARS]; // 相机序列号 float imgExposureTime; // 拍照曝光时间, 单位: us } SImgMark; // 图像类型 typedef enum { IMG_TYPE_BMP = 1, // 拍照输出".bmp"格式的图像文件 IMG_TYPE_JPG = 2, // 拍照输出".jpg"格式的图像文件 } EImgType; #ifdef __cplusplus extern "C" { #endif // 获取系统当前USBFS内存大小(MB), 成功返回: >=0, 失败返回: -1值 int GetSysUsbfsMemCurrentSize(); // 设置系统新的USBFS内存大小(MB), 成功返回: 0值, 失败返回: -1值 int SetSysUsbfsMemSize(int val); // 获取当前连接在USB口上的相机数, 失败返回: <0值, 成功返回: >=0 int GetUsbCameraCount(); // 单次执行相机拍照, 并保存到文件, 成功返回: 0值, 失败返回:非0值 // "imgType" - 获取图像类型 // "saveImgFilename" - 保存的文件名 // "timeout" - 等待超时时间, 单位:秒: < 0 表示无超时; // 无论超时怎么设置, 首次尝试拍照一定会执行 // , 但时间不确定; 拍照成功、超时或发生错误 // 时会自动结束任务(相机持续无数据的时间). // "pImgMark" - 输出本次拍照图像的水印信息, 可以设置NULL int TakePhoto(EImgType imgType, const char *saveImgFilename, int timeout, SImgMark *pImgMark); #ifdef __cplusplus } #endif #endif /* __TAKEPHOTO_H__ */