#pragma once #include #include 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; /// /// 表示一个平面的参数 /// 已知平面上一个点M0(X0,Y0,Z0)和该平面的法向量N(A,B,C) /// 那么平面上任意点M(X,Y,Z)可以表示为A(X-X0)+B(Y-Y0)+C(Z-Z0)=0 /// 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 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& pair1, const std::pair pair2); static bool SortFloatIndexPairAscend(const std::pair& pair1, const std::pair pair2); };