You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
1.8 KiB
C
92 lines
1.8 KiB
C
|
2 months ago
|
#ifndef COMMON_H
|
||
|
|
#define COMMON_H
|
||
|
|
|
||
|
|
#include <opencv2/core.hpp>
|
||
|
|
#include <string>
|
||
|
|
#include <vector>
|
||
|
|
#include <tuple>
|
||
|
|
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
|
struct ShapeInfo {
|
||
|
|
string type;
|
||
|
|
cv::RotatedRect minAreaRect;
|
||
|
|
vector<cv::Point> points;
|
||
|
|
vector<string> ignores;
|
||
|
|
vector<string> needInits;
|
||
|
|
bool implement;
|
||
|
|
|
||
|
|
ShapeInfo();
|
||
|
|
ShapeInfo(const string& t, const cv::RotatedRect& rect,
|
||
|
|
const vector<cv::Point>& pts,
|
||
|
|
const vector<string>& ign,
|
||
|
|
const vector<string>& ni, bool imp);
|
||
|
|
|
||
|
|
ShapeInfo copy() const;
|
||
|
|
};
|
||
|
|
|
||
|
|
enum SHAPETYPE {
|
||
|
|
CIRCULAR = 0,
|
||
|
|
ELLIPTICAL = 1,
|
||
|
|
SQUARE = 2,
|
||
|
|
DIAMOND = 3,
|
||
|
|
TRIANGLE = 4
|
||
|
|
};
|
||
|
|
|
||
|
|
inline const char* const SHAPETYPE_NAMES[] = {"circle", "ellipse", "square", "diamond", "triangle"};
|
||
|
|
|
||
|
|
struct SealInfo {
|
||
|
|
int x1;
|
||
|
|
int y1;
|
||
|
|
int x2;
|
||
|
|
int y2;
|
||
|
|
double conf;
|
||
|
|
int shape;
|
||
|
|
cv::Mat cropped_img;
|
||
|
|
cv::Mat extracted_img;
|
||
|
|
std::string color_name;
|
||
|
|
ShapeInfo shape_info;
|
||
|
|
int angle;
|
||
|
|
cv::Mat adj_img;
|
||
|
|
cv::Mat rm_bd_img;
|
||
|
|
std::vector<cv::Mat> txt_img;
|
||
|
|
std::vector<cv::Mat> rec_img;
|
||
|
|
};
|
||
|
|
|
||
|
|
namespace seal_data {
|
||
|
|
|
||
|
|
class SealDataManager {
|
||
|
|
public:
|
||
|
|
static SealDataManager& getInstance() {
|
||
|
|
static SealDataManager instance;
|
||
|
|
return instance;
|
||
|
|
}
|
||
|
|
|
||
|
|
void setSealSet(const std::vector<SealInfo>& seal_set) {
|
||
|
|
this->seal_set = seal_set;
|
||
|
|
}
|
||
|
|
|
||
|
|
std::vector<SealInfo>& getSealSet() {
|
||
|
|
return seal_set;
|
||
|
|
}
|
||
|
|
|
||
|
|
bool hasSealSet() const {
|
||
|
|
return !seal_set.empty();
|
||
|
|
}
|
||
|
|
|
||
|
|
void clearSealSet() {
|
||
|
|
seal_set.clear();
|
||
|
|
}
|
||
|
|
|
||
|
|
private:
|
||
|
|
SealDataManager() {}
|
||
|
|
~SealDataManager() {}
|
||
|
|
SealDataManager(const SealDataManager&) = delete;
|
||
|
|
SealDataManager& operator=(const SealDataManager&) = delete;
|
||
|
|
|
||
|
|
std::vector<SealInfo> seal_set;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace seal_data
|
||
|
|
|
||
|
|
#endif
|