a
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "Types.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <vector>
|
||||
|
||||
class ColorReader {
|
||||
public:
|
||||
ColorReader();
|
||||
~ColorReader();
|
||||
|
||||
// 执行颜色读取
|
||||
std::vector<ColorResult> readColors(
|
||||
const cv::Mat& image,
|
||||
const std::vector<cv::Point2f>& centers,
|
||||
bool smallLocatorOnLeft,
|
||||
bool applyWB = true // 是否应用白平衡
|
||||
);
|
||||
|
||||
private:
|
||||
// 白平衡处理
|
||||
void applyWhiteBalance(cv::Mat& image);
|
||||
|
||||
// 采样颜色
|
||||
cv::Scalar sampleColor(const cv::Mat& image, const cv::Point2f& center, int radius);
|
||||
|
||||
// 颜色空间转换
|
||||
void convertColorSpaces(const cv::Scalar& bgr,
|
||||
double& h, double& s, double& v,
|
||||
double& l, double& a, double& b);
|
||||
|
||||
// 调整顺序(始终从靠近小定位块开始)
|
||||
std::vector<ColorResult> adjustOrder(
|
||||
std::vector<ColorResult>& colors,
|
||||
bool smallLocatorOnLeft
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user