CircularArresterCurrentALGO.h 1.0 KB

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