IntimediaMeasurement.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef _WIN32
  3. #define EXPORT_API __declspec(dllexport)
  4. #else
  5. #define EXPORT_API
  6. #endif
  7. #include<opencv2/opencv.hpp>
  8. #include<numeric>
  9. #include<vector>
  10. #include<string>
  11. #include<iostream>
  12. #include<chrono>
  13. #include<time.h>
  14. #include<format>
  15. #include<unordered_map>
  16. #include "ErrorMsg.h"
  17. using namespace std;
  18. using namespace cv;
  19. using namespace chrono;
  20. Scalar colorTab[] = {
  21. Scalar(0,0,255),
  22. Scalar(0,255,0),
  23. Scalar(255,0,0),
  24. Scalar(0,255,255),
  25. Scalar(255,0,255),
  26. Scalar(255,255,0),
  27. Scalar(0,0,128) };
  28. typedef struct StructMyPoint
  29. {
  30. int X;
  31. int Y;
  32. }StructMyPoint;
  33. typedef struct ContourInfos
  34. {
  35. int area;
  36. int meanGray;
  37. RotatedRect rotatedRect;
  38. vector<Point> contours;
  39. }ContourInfos;
  40. typedef struct MeasureInfos
  41. {
  42. bool isSuccess;
  43. float averThick;
  44. float minThick;
  45. float maxThick;
  46. StructMyPoint startPoint;
  47. StructMyPoint endPoint;
  48. }MeasureInfos;
  49. extern "C" EXPORT_API bool InterfaceOfIntimeThickness(unsigned char* imgData, int oriWidth, int oriHeight, int objNum, int* labelID,
  50. int* singleContourLenList, StructMyPoint * allContourPoints, bool calcLower, bool calcUpper, MeasureInfos& UpperResult, MeasureInfos& LowerResult);
  51. extern "C" __declspec(dllexport) void GetErrorCodeAndMsg(ErrorCode & errorCode, char* errorMsg, const int errorMaxLen);