12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #pragma once
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <math.h>
- #include <opencv2/imgproc.hpp>
- #include <opencv2/highgui.hpp>
- #include <onnxruntime_cxx_api.h>
- using namespace Ort;
- using namespace cv;
- using namespace std;
- using namespace Ort;
- const float pi = 3.1415926536f;
- const int circle_center[] = { 270, 290 }; //center position[310,320]
- #define SEG_IMAGE_SIZE 512
- #define LINE_HEIGH 120
- #define LINE_WIDTH 1696
- #define CIRCLE_RADIUS 250
- #define METER_RANGE 30
- class AmpereMeterALGO
- {
- public:
- void Init (bool isCuda);
- float detect(Mat& cv_image);
- Mat creat_line_image(const Mat& circle,int Radius, int RingStride);
- float get_meter_reader(const Mat& image);
-
- private:
- int inpWidth;
- int inpHeight;
- int outWidth;
- int outHeight;
- vector<float> input_image_ = { 1, 3, 512, 512 };
- const float mean[3] = { 0.5f, 0.5f, 0.5f };
- const float stds[3] = { 0.5f, 0.5f, 0.5f };
- Env env = Env(ORT_LOGGING_LEVEL_ERROR, "u2net");
- Ort::Session* ort_session = nullptr;
- SessionOptions sessionOptions = SessionOptions();
- vector<char*> input_names;
- vector<char*> output_names;
- vector<vector<int64_t>> input_node_dims; // >=1 outputs
- vector<vector<int64_t>> output_node_dims; // >=1 outputs
- };
|