DoublePointerCountALGO语义分割.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <iostream>
  4. #include <fstream>
  5. #include <string>
  6. #include <math.h>
  7. #include <opencv2/imgproc.hpp>
  8. #include <opencv2/highgui.hpp>
  9. #include <onnxruntime_cxx_api.h>
  10. using namespace cv;
  11. using namespace std;
  12. using namespace Ort;
  13. #define SEG_IMAGE_SIZE 512
  14. #define LINE_HEIGH 120
  15. #define LINE_WIDTH 1600
  16. #define CIRCLE_RADIUS 250
  17. //#define METER_RANGE 9
  18. class DoublePointerCountALGO
  19. {
  20. public:
  21. void Init(bool isCuda);
  22. int detect(Mat& cv_image);
  23. Mat creat_line_image(const Mat& circle,int Radius, int RingStride);
  24. int get_meter_reader(const Mat& image);
  25. private:
  26. int inpWidth;
  27. int inpHeight;
  28. int outWidth;
  29. int outHeight;
  30. const float pi = 3.1415926536f;
  31. const int circle_center[2] = { 256, 256 };//300,238 300,255
  32. const float mean[3] = {0,0,0};
  33. const float stds[3] = {0.9f,0.9f,0.9f};
  34. Env env = Env(ORT_LOGGING_LEVEL_ERROR, "u2net");
  35. Ort::Session* ort_session = nullptr;
  36. SessionOptions sessionOptions = SessionOptions();
  37. vector<char*> input_names;
  38. vector<char*> output_names;
  39. vector<vector<int64_t>> input_node_dims; // >=1 outputs
  40. vector<vector<int64_t>> output_node_dims; // >=1 outputs
  41. };