| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // Author: NiuJiuRu
- // Email: niujiuru@qq.com
- // Date: 2026-01-14 【新增支持大华相机】
- #ifndef __DH_TAKEPHOTO_H__
- #define __DH_TAKEPHOTO_H__
- #include "./include/IMVApi.h"
- #include "../swapi/include_swapiLib.h"
- #undef MAX_LINE_CHARS
- #define MAX_LINE_CHARS IMV_MAX_STRING_LENTH // ☝
- // 图像水印
- typedef struct
- {
- char camModelName[MAX_LINE_CHARS]; // 相机型号名
- char camSerialNum[MAX_LINE_CHARS]; // 相机序列号
- double imgExposureTime; //拍照曝光时间, 单位: us
- unsigned int imgWidth; // 拍照图像宽度, 单位: px
- unsigned int imgHeight;// 拍照图像高度, 单位: px
- } DHImgMark;
- // 图像类型
- typedef enum
- {
- IMG_TYPE_BMP = 1, // 拍照输出".bmp"格式的图像文件
- IMG_TYPE_JPG = 2, // 拍照输出".jpg"格式的图像文件
- } DHImgType;
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- // 获取系统当前USBFS内存大小(MB), 成功返回: >=0, 失败返回: <0值
- int DH_GetSysUsbfsMemCurrentSize();
- // 设置系统新的USBFS内存大小(MB), 成功返回: 0值, 失败返回: <0值
- int DH_SetSysUsbfsMemSize(int val);
- // 获取当前已连接的海康相机的数量, 成功返回: >=0, 失败返回: <0值
- int DH_GetCameraCount();
- // 单次拍照时, 如果相机处于自动曝光模式, 是否等待曝光稳定后再拍照
- int DH_SetWaitAEDoneForTakePhoto(int waitAE); // waitAE: 0=不等待, 1=等待(默认)
- // 单次执行相机拍照, 并保存到文件, 成功返回: 0值, 失败返回:非0值
- // "imgType" - 获取图像类型
- // "saveImgPath" - 保存的文件名
- // "timeout" - 等待超时时间, 单位:秒: < 0 表示无超时;
- // 无论超时怎么设置, 首次尝试拍照一定会执行
- // , 但时间不确定; 拍照成功、超时或发生错误
- // 时会自动结束任务(相机持续无数据的时间).
- // "pImgMark" - 输出本次拍照图像的水印信息, 可以设置NULL
- int DH_TakePhoto(DHImgType imgType, const char *saveImgPath, int timeout, DHImgMark *pImgMark);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __DH_TAKEPHOTO_H__ */
|