AtmosphericPressureALGO.h 1004 B

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. class AtmosphericPressureALGO
  14. {
  15. public:
  16. void Init();
  17. bool detect(Mat cv_image);
  18. float resultValue;
  19. private:
  20. void creat_line_image(int Radius, int RingStride);
  21. void get_meter_reader();
  22. private:
  23. int inpWidth;
  24. int inpHeight;
  25. int outWidth;
  26. int outHeight;
  27. //vector<float> input_image_ = { 1, 3, 512, 512 };
  28. const float mean[3] = { 0, 0, 0 };
  29. const float stds[3] = { 0.6f, 0.6f, 0.6f };
  30. Env env = Env(ORT_LOGGING_LEVEL_ERROR, "u2net");
  31. Ort::Session* ort_session = nullptr;
  32. SessionOptions sessionOptions = SessionOptions();
  33. vector<char*> input_names;
  34. vector<char*> output_names;
  35. vector<vector<int64_t>> input_node_dims; // >=1 outputs
  36. vector<vector<int64_t>> output_node_dims; // >=1 outputs
  37. Mat dstimg;
  38. };