123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef __TYPE_DEF_H__
- #define __TYPE_DEF_H__
- // *****************************************************************************
- // 版权所有(C)2023~2099 上海骄成超声波技术有限公司
- // 保留所有权利
- // *****************************************************************************
- // 作者 : 李祥瑞
- // 版本 : 1.0
- // 代码创建日期:2024/11/19
- // 版本更新日期:2025/01/10
- // 功能说明: 定位算法接口使用的基本数据结构
- // *****************************************************************************
- #if defined(JVISION_LIB_EXPORT)
- #define JVision_API __declspec(dllexport)
- #else
- #define JVision_API __declspec(dllimport)
- #endif
- #include <string>
- #define M_PI (3.14159256)
- namespace JVision
- {
- // 图像数据类型,指向内存中的图像二进制数据
- typedef JVision_API unsigned char* ImageDataPtr;
- // 返回值类型
- typedef JVision_API int ResultCode;
- // 参数ID类型
- typedef JVision_API int ParamID;
- // 参数值类型
- typedef JVision_API std::string ParamVal;
- /**
- * @brief 以像素点表示的坐标
- */
- struct JVision_API Point
- {
- double x;//(像素坐标,零点在左上角)
- double y;
- double angle; // 角度(x正方向为0,逆时针为正)
- };
- struct JVision_API Point2D
- {
- double x;//(像素坐标,零点在左上角)
- double y;
- };
- struct JVision_API CircleResult
- {
- double x;
- double y;
- double radius;
- };
- enum class JVision_API ImageFormat : int
- {
- INVALID = 0, // 无效
- GRAY8, // 灰度图,色值0~255
- RGB888, // 每个像素 24 位,顺序是 0xRRGGBB,没有 Alpha 通道
- ARGB32, // 带有 Alpha 通道的 32 位像素格式,顺序是 0xAARRGGBB
- RGB32, // 每个像素 32 位,其中包含了 RGB 颜色信息,顺序通常是 0xAARRGGBB(最高字节为 Alpha 通道,但被忽略,因为 Alpha 通道总是视为 0xFF)
- YUV422, // YUV4:2:2
- };
- struct JVision_API ImageInfo
- {
- ImageInfo();
- ImageInfo(int w, int h, int c, ImageFormat f, unsigned char* d);
- ImageInfo(unsigned char* d, int w, int h, int c)
- : width(w)
- , height(h)
- , channel(c)
- , data(nullptr)
- {
- int imageSize = w * h * c;
- data = new unsigned char[imageSize];
- memcpy(data, d, imageSize);
- }
- ImageInfo(const ImageInfo& other);
- ImageInfo(ImageInfo&& other) noexcept;
- ImageInfo& operator=(ImageInfo& other);
- ImageInfo& operator=(ImageInfo&& other) noexcept;
- ~ImageInfo();
- int width; // 图像宽度
- int height; // 图像高度
- int channel; // 图像通道数
- ImageFormat format; // 图像格式
- unsigned char* data; // 图像数据
- };
- }
- #endif
|