66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
/*
|
||
* ====================================================
|
||
|
||
* 功能:通道提取,又名除色。可提取BGR图像中的单个通道、两种通道的混合以及去除彩色像素的图像,目标图像均为灰度图
|
||
* 作者:刘丁维
|
||
* 生成时间:2020/4/21
|
||
* 最近修改时间:v1.0 2020/4/21
|
||
v1.1 2020/6/11 在除红时,增加对比度,提高除色效果。
|
||
v1.2 2020/7/21 修正之前增强红绿蓝效果的色彩配比。
|
||
v1.3 2021/5/24 替换红色增强算法方案。
|
||
* 版本号:v1.3
|
||
|
||
* ====================================================
|
||
*/
|
||
|
||
#ifndef IMAGE_APPLY_CHANNEL_H
|
||
#define IMAGE_APPLY_CHANNEL_H
|
||
|
||
#include "ImageApply.h"
|
||
|
||
class CImageApplyAdjustColors;
|
||
class GIMGPROC_LIBRARY_API CImageApplyChannel : public CImageApply
|
||
{
|
||
public:
|
||
|
||
typedef enum channel
|
||
{
|
||
Red, //红色通道
|
||
Green, //绿色通道
|
||
Blue, //蓝色通道
|
||
All, //去除所有HSV色彩结构中,S大于80的色彩
|
||
Invalid, //无效
|
||
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
|