takephoto.h 1.6 KB

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