qt-correction-tool/imageprocess/ImageApplyChannel.h

65 lines
1.6 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.

/*
* ====================================================
* 功能通道提取又名除色。可提取BGR图像中的单个通道、两种通道的混合以及去除彩色像素的图像目标图像均为灰度图
* 作者:刘丁维
* 生成时间2020/4/21
* 最近修改时间v1.0 2020/4/21
v1.1 2020/6/11 在除红时,增加对比度,提高除色效果。
v1.2 2020/7/21 修正之前增强红绿蓝效果的色彩配比。
* 版本号v1.2
* ====================================================
*/
#ifndef IMAGE_APPLY_CHANNEL_H
#define IMAGE_APPLY_CHANNEL_H
#include "ImageApply.h"
class CImageApplyAdjustColors;
class CImageApplyChannel : public CImageApply
{
public:
typedef enum channel
{
Red, //红色通道
Green, //绿色通道
Blue, //蓝色通道
Invalid, //无效
All, //去除所有HSV色彩结构中S大于80的色彩
Except_Red, //绿蓝色通道混合
Except_Green, //红蓝色通道混合
Except_Blue //红绿色通道混合
}Channel;
public:
CImageApplyChannel();
/*
* channel [in]:通道模式
* */
CImageApplyChannel(Channel channel);
virtual ~CImageApplyChannel(void);
virtual void apply(cv::Mat& pDib,int side);
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
private:
void except_channel(const cv::Mat& src, cv::Mat& dst, int channel);
void colourless(const cv::Mat& src, cv::Mat& dst, uchar threshold = 80);
private:
Channel m_channel;
CImageApplyAdjustColors* colors;
};
#endif // !IMAGE_APPLY_CHANNEL_H