1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #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>
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <math.h>
- #include <cmath>
- #include <opencv2/imgproc.hpp>
- #include <opencv2/highgui.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include "opencv2/imgproc/types_c.h"
- #include <onnxruntime_cxx_api.h>
- #include <vector>
- using namespace cv;
- using namespace std;
- using namespace Ort;
- #define SEG_IMAGE_SIZE 512
- #define LINE_HEIGH 120
- #define LINE_WIDTH 1600
- #define CIRCLE_RADIUS 250
- //#define METER_RANGE 120
- class DoubleTemperatureGuageALGO
- {
- private:
- const float pi = 3.1415926536f;
- const int circle_center[2] = { 270, 256 };//300,238 300,255
- int METER_RANGE = 120;
- public:
- void Init(bool IsCuda);
- pair<float, float> detect(Mat& cv_image, int MaxRange);
- Mat creat_line_image(const Mat& circle, int Radius, int RingStride);
- pair<float, float> get_meter_reader(const Mat& image);
- private:
- int inpWidth;
- int inpHeight;
- int outWidth;
- int outHeight;
- 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
- };
|