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.
 
 
 
 
 
 

74 lines
1.8 KiB

#ifndef COLORCOMPARISONPIXEL_H
#define COLORCOMPARISONPIXEL_H
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include "ColorComparisonFace.h"
/*
// 不使用前向声明,直接定义简单的颜色结构
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 ColorComparisonPixel {
private:
struct ColorInfo {
int faceId;
MeshColor gaussianColor;
MeshColor originalColor;
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:
// 构造函数
ColorComparisonPixel(const std::string& dir);
// 析构函数
virtual ~ColorComparisonPixel() {}
// 添加颜色信息
void addColorInfo(int faceId,
const MeshColor& gaussianColor,
const MeshColor& originalColor,
float distance, float threshold,
const std::string& filename);
// 创建按faceid分组的对比图
void createBatchComparison(int maxCellsPerRow = 10, int maxFacesPerImage = 50);
// 保存颜色信息到CSV文件
void saveColorInfoToFile();
// 获取总face数
int getTotalFaces() const;
// 获取总记录数
int getTotalRecords() const;
// 获取faceid列表
std::vector<int> getFaceIds() const;
};
#endif // COLORCOMPARISONPIXEL_H