123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #pragma once
- #include <opencv2/opencv.hpp>
- #include <cmath>
- enum ErrorCode
- {
- None = 0,
- EncodeError = 1,
- DecodeError = 2,
- StraightScanDataUniformError = 3,
- LinearInterpolationError = 4,
- GetSurfaceError = 5,
- FusionError = 6,
- };
- enum ColorType
- {
- Gray8,
- Gray16,
- Rgb,
- Bgr,
- Bgra,
- Rgba,
- GrayF32,
- };
- typedef struct
- {
- int left;
- int top;
- int right;
- int bottom;
- int width;
- int height;
- }Rect;
- /// <summary>
- /// 表示一个平面的参数
- /// 已知平面上一个点M0(X0,Y0,Z0)和该平面的法向量N(A,B,C)
- /// 那么平面上任意点M(X,Y,Z)可以表示为A(X-X0)+B(Y-Y0)+C(Z-Z0)=0
- /// </summary>
- typedef struct
- {
- float x0;
- float y0;
- float z0;
- float a;
- float b;
- float c;
- }Plane;
- typedef struct
- {
- int origImgWidth;
- int origImgHeight;
- int origImgCount;
- ColorType colorType;
- Rect cropRect;
- int desiredImgWidth;
- int desiredImgHeight;
- int desiredImgCount;
- uint8_t* dataBuffer;
- }VolumeDataPreProcessorInfo;
- typedef struct
- {
- int x;
- int y;
- int z;
- float spacing;
- ColorType colorType;
- uint8_t* dataBuffer;
- }UniformVolumeDataInfo;
- typedef struct
- {
- int width;
- int height;
- ColorType colorType;
- uint8_t* dataBuffer;
- }ImageInfo;
- class ImageHelper
- {
- public:
- static int GetDepthFlag(ColorType colorType);
- static int GetBytesPerPixel(ColorType colorType);
- static bool NeedCrop(cv::Rect cropRect, int width, int height);
- };
- class ErrorMsg
- {
- public:
- ~ErrorMsg();
- static void SetErrorMsg(ErrorCode errorCode, std::vector<const char*> errorMsgs);
- static void GetErrorMsg(ErrorCode& errorCode, char* errorMsg, const int errorMaxLen);
- private:
- static char* _errorMsg;
- static ErrorCode _errorCode;
- };
- class MathTools
- {
- public:
- static float Distance(cv::Point3f point1, cv::Point3f point2);
- static bool SortFloatIndexPairDescend(const std::pair<float, int>& pair1, const std::pair<float, int> pair2);
- static bool SortFloatIndexPairAscend(const std::pair<float, int>& pair1, const std::pair<float, int> pair2);
- };
|