65 lines
1.2 KiB
C++
65 lines
1.2 KiB
C++
#ifndef IMAGE_APPLY_BW_BINARAY_H
|
|
#define IMAGE_APPLY_BW_BINARAY_H
|
|
|
|
#include "ImageApply.h"
|
|
|
|
class CImageApplyBWBinaray:public CImageApply
|
|
{
|
|
public:
|
|
|
|
enum ThresholdType
|
|
{
|
|
THRESH_BINARY = 0,
|
|
THRESH_OTSU,
|
|
|
|
ADAPTIVE_GAUSSIAN,
|
|
ADAPTIVE_MEAN,
|
|
|
|
ERROR_DIFFUSION
|
|
};
|
|
|
|
CImageApplyBWBinaray(ThresholdType type, int threshold = 180, int blockSize = 25, int constant = 5);
|
|
|
|
CImageApplyBWBinaray();
|
|
|
|
virtual ~CImageApplyBWBinaray(void);
|
|
|
|
virtual void apply(cv::Mat& pDib,int side);
|
|
|
|
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
|
|
|
|
double getThreshold() { return m_threshold; }
|
|
|
|
ThresholdType getThresholdType() { return m_type; }
|
|
|
|
int getBlockSize() { return m_blockSize; }
|
|
|
|
double getConstant() { return m_constant; }
|
|
|
|
void setThreshold(double value) { m_threshold = value; }
|
|
|
|
void setThresholdType(ThresholdType type) { m_type = type; }
|
|
|
|
void setBlockSize(int value) { m_blockSize = value; }
|
|
|
|
void setConstant(double value) { m_constant = value; }
|
|
|
|
private:
|
|
|
|
void errorDiffuse(cv::Mat& image);
|
|
|
|
private:
|
|
double m_threshold;
|
|
|
|
ThresholdType m_type;
|
|
|
|
int m_blockSize;
|
|
|
|
double m_constant;
|
|
|
|
uchar* m_table;
|
|
};
|
|
|
|
#endif //!IMAGE_APPLY_BW_BINARAY_H
|
|
|