You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
1.8 KiB

#ifndef COLORCOMPARISONBFACE_H
#define COLORCOMPARISONBFACE_H
#include <string>
#include <vector>
#include <map>
// 不使用前向声明,直接定义简单的颜色结构
struct MeshColor {
unsigned char r, g, b;
MeshColor() : r(0), g(0), b(0) {}
MeshColor(unsigned char r, unsigned char g, unsigned char b)
: r(r), g(g), b(b) {}
unsigned char operator[](size_t idx) const {
if (idx == 0) return r;
if (idx == 1) return g;
if (idx == 2) return b;
return 0;
}
};
class ColorComparisonFace {
private:
struct ColorInfo {
int faceId;
MeshColor gaussianColor;
cv::Mat imageRegion; // 存储实际图像区域
float distance;
float threshold;
std::string filename;
};
// 使用嵌套map: faceid -> filename -> ColorInfo列表
std::map<int, std::map<std::string, std::vector<ColorInfo>>> faceViewColorMap;
std::string outputDir;
public:
// 构造函数
ColorComparisonFace(const std::string& dir);
// 析构函数
virtual ~ColorComparisonFace() {}
// 添加颜色信息(带图像区域)
void addColorInfo(int faceId,
const MeshColor& gaussianColor,
const cv::Mat& imageRegion,
float distance, float threshold,
const std::string& filename);
// 创建实际图像区域对比图
void createBatchComparison(int maxBlocksPerRow = 6, int maxFacesPerImage = 20);
// 保存颜色信息到CSV文件
void saveColorInfoToFile();
// 获取总face数
int getTotalFaces() const;
// 获取总记录数
int getTotalRecords() const;
// 获取faceid列表
std::vector<int> getFaceIds() const;
};
#endif // COLORCOMPARISONBFACE_H