a
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
#pragma once
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// 试纸联数
|
||||
enum class BlockItems {
|
||||
BI_14 = 14,
|
||||
BI_11 = 11,
|
||||
BI_8 = 8
|
||||
};
|
||||
|
||||
// 大定位块类型
|
||||
enum class BigLocatorType {
|
||||
BLT_SHORT = 0, // 10mm
|
||||
BLT_LONG = 1 // 15mm
|
||||
};
|
||||
|
||||
// 定位块颜色分类
|
||||
enum class LocatorColor {
|
||||
UNKNOWN = 0,
|
||||
RED = 1,
|
||||
GREEN = 2,
|
||||
BLUE = 3
|
||||
};
|
||||
|
||||
// 试纸空间类型
|
||||
enum class PaperSpatialType {
|
||||
PST_UNKNOWN = 0,
|
||||
PST_14_S = 1, // 14联, 10mm大定位块
|
||||
PST_14_L = 2, // 14联, 15mm大定位块
|
||||
PST_11_S = 3, // 11联, 10mm大定位块
|
||||
PST_11_L = 4, // 11联, 15mm大定位块
|
||||
PST_8_S = 5, // 8联, 10mm大定位块
|
||||
PST_8_L = 6 // 8联, 15mm大定位块
|
||||
};
|
||||
|
||||
// 图像清晰度等级
|
||||
enum class BlurLevel {
|
||||
BLUR_NONE = 0, // 清晰
|
||||
BLUR_SLIGHT = 1, // 轻微模糊
|
||||
BLUR_SEVERE = 2 // 严重模糊
|
||||
};
|
||||
|
||||
// 定位块信息
|
||||
struct LocatorInfo {
|
||||
cv::RotatedRect rotatedRect; // 旋转矩形
|
||||
cv::Point2f center; // 中心点
|
||||
double area; // 面积
|
||||
double width; // 宽度(长边)
|
||||
double height; // 高度(短边)
|
||||
LocatorColor color; // 颜色
|
||||
bool isBig; // 是否大定位块
|
||||
cv::Scalar avgColor; // 平均RGB颜色
|
||||
|
||||
LocatorInfo() : area(0), width(0), height(0),
|
||||
color(LocatorColor::UNKNOWN), isBig(false) {}
|
||||
};
|
||||
|
||||
// 色块颜色结果
|
||||
struct ColorResult {
|
||||
int id; // 编号(从靠近小定位块开始)
|
||||
double h, s, v; // HSV值
|
||||
double l, a, b; // LAB值
|
||||
double r, g, b_val; // RGB值
|
||||
|
||||
ColorResult() : id(0), h(0), s(0), v(0), l(0), a(0), b(0),
|
||||
r(0), g(0), b_val(0) {}
|
||||
};
|
||||
|
||||
// 识别结果
|
||||
struct RecognitionResult {
|
||||
bool success; // 是否成功
|
||||
int errorCode; // 错误码
|
||||
std::string errorMessage; // 错误信息
|
||||
PaperSpatialType paperType; // 试纸类型
|
||||
LocatorColor locatorColor; // 定位块颜色
|
||||
int itemCount; // 色块数量
|
||||
std::vector<cv::Point2f> colorBlockCenters; // 色块中心点
|
||||
std::vector<ColorResult> colors; // 颜色结果
|
||||
cv::Mat annotatedImage; // 标注后的图片
|
||||
bool smallLocatorOnLeft; // 小定位块是否在左边
|
||||
BlurLevel blurLevel; // 图像清晰度等级
|
||||
double blurScore; // 清晰度分数(方差值)
|
||||
|
||||
RecognitionResult() : success(false), errorCode(-1),
|
||||
paperType(PaperSpatialType::PST_UNKNOWN),
|
||||
locatorColor(LocatorColor::UNKNOWN),
|
||||
itemCount(0), smallLocatorOnLeft(true),
|
||||
blurLevel(BlurLevel::BLUR_NONE), blurScore(0) {}
|
||||
};
|
||||
Reference in New Issue
Block a user