Read@CVL
rdf::BinarizationSuAdapted Class Reference

The class binarize a grayvalue image. The segmentation algorithm is based on "Binarization of Historical Document Images Using Local Maximum and Minimum", Bolan Su, Shijian Lu and Chew Lim Tan, DAS 2010. In contrast to DkSegmentationSu the ContrastImg is adapted and the strokeWidth is constant. More...

#include <Binarization.h>

Inheritance diagram for rdf::BinarizationSuAdapted:
Collaboration diagram for rdf::BinarizationSuAdapted:

Public Member Functions

 BinarizationSuAdapted (const cv::Mat &img, const cv::Mat &mask=cv::Mat())
 Initializes a new instance of the BinarizationSuAdapted class. More...
 
virtual bool compute () override
 Computes the binary image using the adapted method of Su. More...
 
virtual QString toString () const override
 Summary of parameters as String. More...
 
void setFiltering (bool medianFilter)
 If set, a median filter of size 3 is applied at the end. More...
 
- Public Member Functions inherited from rdf::BaseBinarizationSu
 BaseBinarizationSu (const cv::Mat &img, const cv::Mat &mask=cv::Mat())
 Initializes a new instance of the BaseBinarizationSu class. More...
 
bool isEmpty () const override
 Determines whether this instance is empty. More...
 
cv::Mat binaryImage () const
 Returns the binary image. More...
 
void setPreFiltering (bool preFilter=true, int preFilterSize=10)
 Sets the preFiltering. All blobs smaller than preFilterSize are removed if preFilter is true. More...
 
QSharedPointer< BaseBinarizationSuConfigconfig () const
 
- Public Member Functions inherited from rdf::Module
 Module ()
 Default constructor Initializes a new instance of the Module class. More...
 
virtual QString name () const
 Returns the module's name. More...
 
virtual void setConfig (QSharedPointer< ModuleConfig > config)
 
QSharedPointer< ModuleConfigconfig () const
 

Protected Member Functions

float setStrokeWidth (float strokeW)
 
virtual float thresholdVal (float *mean, float *std) const
 
virtual float contrastVal (const unsigned char *maxVal, const unsigned char *minVal) const override
 
virtual void calcFilterParams (int &filterS, int &Nm) override
 
- Protected Member Functions inherited from rdf::BaseBinarizationSu
cv::Mat compContrastImg (const cv::Mat &srcImg, const cv::Mat &mask) const
 
cv::Mat compBinContrastImg (const cv::Mat &contrastImg) const
 
virtual float strokeWidth (const cv::Mat &contrastImg) const
 
void computeDistHist (const cv::Mat &src, QList< int > *maxDiffList, QList< float > *localIntensity) const
 
void computeThrImg (const cv::Mat &grayImg32F, const cv::Mat &binContrast, cv::Mat &thresholdImg, cv::Mat &thresholdContrastPxImg)
 
bool checkInput () const override
 
- Protected Member Functions inherited from rdf::Module
QString debugName () const
 

Protected Attributes

cv::Mat mContrastImg
 
cv::Mat mBinContrastImg
 
cv::Mat mThrImg
 
- Protected Attributes inherited from rdf::BaseBinarizationSu
cv::Mat mSrcImg
 
cv::Mat mBwImg
 
cv::Mat mMask
 
bool mPreFilter = true
 
int mPreFilterSize = 10
 
float mStrokeW = 4
 
- Protected Attributes inherited from rdf::Module
QSharedPointer< ModuleConfigmConfig
 

Detailed Description

The class binarize a grayvalue image. The segmentation algorithm is based on "Binarization of Historical Document Images Using Local Maximum and Minimum", Bolan Su, Shijian Lu and Chew Lim Tan, DAS 2010. In contrast to DkSegmentationSu the ContrastImg is adapted and the strokeWidth is constant.

See also
BaseBinarizationSu

Constructor & Destructor Documentation

rdf::BinarizationSuAdapted::BinarizationSuAdapted ( const cv::Mat &  img,
const cv::Mat &  mask = cv::Mat() 
)

Initializes a new instance of the BinarizationSuAdapted class.

Parameters
imgThe source img CV_8U.
maskThe optional mask CV_8UC1.

Member Function Documentation

void rdf::BinarizationSuAdapted::calcFilterParams ( int &  filterS,
int &  Nm 
)
overrideprotectedvirtual

Reimplemented from rdf::BaseBinarizationSu.

bool rdf::BinarizationSuAdapted::compute ( )
overridevirtual

Computes the binary image using the adapted method of Su.

Returns
True if the thresholded image could be computed.

Reimplemented from rdf::BaseBinarizationSu.

Reimplemented in rdf::BinarizationSuFgdWeight.

float rdf::BinarizationSuAdapted::contrastVal ( const unsigned char *  maxVal,
const unsigned char *  minVal 
) const
overrideprotectedvirtual

Reimplemented from rdf::BaseBinarizationSu.

void rdf::BinarizationSuAdapted::setFiltering ( bool  medianFilter)

If set, a median filter of size 3 is applied at the end.

Parameters
medianFilterif set to true [median filter] with size 3 is applied.
float rdf::BinarizationSuAdapted::setStrokeWidth ( float  strokeW)
protected
float rdf::BinarizationSuAdapted::thresholdVal ( float *  mean,
float *  std 
) const
inlineprotectedvirtual

Reimplemented from rdf::BaseBinarizationSu.

QString rdf::BinarizationSuAdapted::toString ( ) const
overridevirtual

Summary of parameters as String.

Returns
Summary of parameters.

Reimplemented from rdf::BaseBinarizationSu.

Member Data Documentation

cv::Mat rdf::BinarizationSuAdapted::mBinContrastImg
protected
cv::Mat rdf::BinarizationSuAdapted::mContrastImg
protected
cv::Mat rdf::BinarizationSuAdapted::mThrImg
protected

The documentation for this class was generated from the following files: