code_device/hgdriver/ImageProcess/ImageApplyColorCastCorrect.h

89 lines
2.8 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* ====================================================
* 功能:色偏校正
* 作者:刘丁维
* 生成时间2022/12/01
* 最近修改时间v1.0 2022/12/01
* v1.1 2022/12/01 增加从文件中读取查值表数据接口;增加导出查值表数据接口
* v1.1.1 2023/03/24 增加预设方案
* v1.2 2023/04/04 提高曲线拐点数增加预设方案CIS_DN_PATCH3
* v1.3 2023/04/17 增加新查值表导入方式。
* v2.0 2023/05/15 重构查值表算法。
* v2.1 2023/10/07 添加饱和度、亮度调节,当前暂不开放参数设置接口。
* v2.2 2023/11/13 增加预设方案
* v2.2.1 2023/11/13 调整枚举类型词条
* v2.2.2 2023/11/17 屏蔽无用代码
* v2.2.3 2023/11/17 调整饱和度校正系数
* 版本号v2.2.3
* ====================================================
*/
#ifndef IMAGE_APPLY_COLOR_CAST_CORRECT_H
#define IMAGE_APPLY_COLOR_CAST_CORRECT_H
#include "ImageApply.h"
class GIMGPROC_LIBRARY_API CImageApplyColorCastCorrect : public CImageApply
{
public:
//预设方案
enum PreScheme
{
G200,
G300,
G300_D8,
G300_7010,
G400_402,
G400_3288,
Android302
};
CImageApplyColorCastCorrect(PreScheme ps = G200);
CImageApplyColorCastCorrect(const std::vector<double>& h_x, const std::vector<double>& h_y,
const std::vector<double>& l_x, const std::vector<double>& l_y,
const std::vector<double>& s_x, const std::vector<double>& s_y);
/// <summary>
/// 用户自定义查值表
/// </summary>
/// <param name="points_x">HSV色彩空间H通道曲线变换节点坐标X轴</param>
/// <param name="points_y">HSV色彩空间H通道曲线变换节点坐标Y轴</param>
CImageApplyColorCastCorrect(const std::vector<double>& points_x, const std::vector<double>& points_y);
/// <summary>
/// 从文件中加载现有查值表数据
/// </summary>
/// <param name="fileName"></param>
CImageApplyColorCastCorrect(const std::string& fileName);
/// <summary>
/// 针对HSV中H通道的LUT校正数据
/// </summary>
/// <param name="table_h"></param>
CImageApplyColorCastCorrect(const uchar* table_h);
virtual ~CImageApplyColorCastCorrect(void);
virtual void apply(cv::Mat& pDib, int side);
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
/// <summary>
/// 导出当前查值表数据
/// </summary>
/// <param name="fileName"></param>
void exportTableData(const std::string& fileName);
private:
void createTable_h(const std::vector<double>& points_x, const std::vector<double>& points_y);
void createTable_l(const std::vector<double>& points_x, const std::vector<double>& points_y);
void createTable_s(const std::vector<double>& points_x, const std::vector<double>& points_y);
private:
uchar* m_table_h, *m_table_l, *m_table_s;
};
#endif