libcrn
3.9.5
A document image processing library
|
Typedefs | |
using | crn::ImageGray = Image< uint8_t > |
Grayscale image class. More... | |
using | crn::ImageIntGray = Image< int > |
Int grayscale image class. More... | |
using | crn::ImageDoubleGray = Image< double > |
double Grayscale image class More... | |
Functions | |
void | crn::Sqrt (ImageDoubleGray &img) noexcept |
Replaces the pixels with their square root. More... | |
template<typename T > | |
void | crn::Abs (Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) noexcept |
Replaces each pixel by its absolute value. More... | |
void | crn::AutoContrast (ImageGray &img) |
template<typename T > | |
Histogram | crn::MakeHistogram (const Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
Histogram | crn::MakeHistogram (const ImageGray &img) |
Creates an histogram from the pixels. More... | |
Histogram | crn::HorizontalProjection (const ImageGray &img) |
Computes the horizontal projection. More... | |
Histogram | crn::VerticalProjection (const ImageGray &img) |
Computes the vertical projection. More... | |
template<typename T > | |
size_t | crn::StrokesWidth (const Image< T > &img, size_t maxval=50, size_t defaultval=0, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
size_t | crn::StrokesHeight (const Image< T > &img, size_t maxval=50, size_t defaultval=0, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
size_t | crn::EstimateLinesXHeight (const ImageGray &img, unsigned int xdiv=16) |
Computes the mean text line x-height. More... | |
size_t | crn::EstimateLeading (const ImageGray &img) |
Computes the median distance between two baselines. More... | |
Angle< Radian > | crn::EstimateSkew (const ImageGray &img) |
Estimates the mean skew of the document's lines. More... | |
template<typename T > | |
ImageRGB | crn::RandomColors (const Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T , typename CMP = std::less<T>> | |
ImageBW | crn::Threshold (const Image< T > &img, T thresh, CMP cmp=std::less< T >{}) |
template<typename T > | |
ImageBW | crn::Niblack (const Image< T > &img, size_t halfwin, double k=0.5, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::Sauvola (const Image< T > &img, size_t halfwin, double k=0.5, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::kMeansHisto (const Image< T > &img, size_t classes, size_t black_classes, size_t maxcnt=10000, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::LocalMin (const Image< T > &img, size_t area=1, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::LocalMax (const Image< T > &img, size_t area=1, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::Fisher (const Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::Entropy (const Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
template<typename T > | |
ImageBW | crn::Otsu (const Image< T > &img, typename std::enable_if< std::is_arithmetic< T >::value >::type *dummy=nullptr) |
ImageBW | crn::MakeImageBW (const ImageGray &img) |
using crn::ImageDoubleGray = typedef Image<double> |
double Grayscale image class
This class is for grayscale images. Values in pixels' vector represent values for luminosity.
Definition at line 87 of file CRNImageFormats.h.
using crn::ImageGray = typedef Image<uint8_t> |
Grayscale image class.
This class is for grayscale images. Values in pixels' vector represent values for luminosity.
Definition at line 59 of file CRNImageFormats.h.
using crn::ImageIntGray = typedef Image<int> |
Int grayscale image class.
This class is for grayscale images. Values in pixels' vector represent values for luminosity.
Definition at line 73 of file CRNImageFormats.h.
|
noexcept |
Replaces each pixel by its absolute value.
Definition at line 47 of file CRNImageGray.h.
void crn::AutoContrast | ( | ImageGray & | img | ) |
Stretches the histogram
Stretches the histogram
[in] | img | the image to modify |
Definition at line 516 of file CRNImageGray.cpp.
ImageBW crn::Entropy | ( | const Image< T > & | img, |
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image using the entropy threshold
[in] | img | the image to binarize |
Definition at line 553 of file CRNImageGray.h.
size_t crn::EstimateLeading | ( | const ImageGray & | img | ) |
Computes the median distance between two baselines.
[in] | img | the source image |
Definition at line 673 of file CRNImageGray.cpp.
size_t crn::EstimateLinesXHeight | ( | const ImageGray & | img, |
unsigned int | xdiv = 16 |
||
) |
Computes the mean text line x-height.
Computes the mean text line x-height
[in] | img | the source image |
Definition at line 616 of file CRNImageGray.cpp.
Estimates the mean skew of the document's lines.
Estimates the mean skew of the document's lines
[in] | img | the source image |
Definition at line 727 of file CRNImageGray.cpp.
ImageBW crn::Fisher | ( | const Image< T > & | img, |
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image using the Fisher criterion
[in] | img | the image to binarize |
Definition at line 521 of file CRNImageGray.h.
Computes the horizontal projection.
Computes the horizontal projection
Definition at line 567 of file CRNImageGray.cpp.
ImageBW crn::kMeansHisto | ( | const Image< T > & | img, |
size_t | classes, | ||
size_t | black_classes, | ||
size_t | maxcnt = 10000 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image through a classification of the histogram
[in] | img | the image to binarize |
[in] | classes | the total number of classes to compute |
[in] | black_classes | the total number of classes that represent the black pixels |
[in] | maxcnt | the maximal number of loops |
Definition at line 335 of file CRNImageGray.h.
ImageBW crn::LocalMax | ( | const Image< T > & | img, |
size_t | area = 1 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image the local maxima
[in] | img | the image to binarize |
[in] | area | the half window size (window size = 1 + 2 * area). |
Definition at line 463 of file CRNImageGray.h.
ImageBW crn::LocalMin | ( | const Image< T > & | img, |
size_t | area = 1 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image the local minima
[in] | img | the image to binarize |
[in] | area | the half window size (window size = 1 + 2 * area). |
Definition at line 404 of file CRNImageGray.h.
Histogram crn::MakeHistogram | ( | const Image< T > & | img, |
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates an histogram from the pixels
[in] | img | the image to binarize |
Definition at line 64 of file CRNImageGray.h.
Creates an histogram from the pixels.
Creates an histogram from the pixels
[in] | img | the image to binarize |
Definition at line 601 of file CRNImageGray.cpp.
Definition at line 935 of file CRNImageGray.cpp.
ImageBW crn::Niblack | ( | const Image< T > & | img, |
size_t | halfwin, | ||
double | k = 0.5 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image using Niblack's algorithm the binarisation use a threshold on a square window of neighbouring pixels the threshold t is calculated by
t = m + k*s
[in] | img | the image to binarize |
[in] | halfwin | size of the square window of neighbouring pixels, from the border of the window to the central pixel |
[in] | k | parameter k |
Definition at line 229 of file CRNImageGray.h.
ImageBW crn::Otsu | ( | const Image< T > & | img, |
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image using the Otsu's algorithm
[in] | img | the image to binarize |
Definition at line 585 of file CRNImageGray.h.
ImageRGB crn::RandomColors | ( | const Image< T > & | img, |
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Exports to an RGB image with random colors
[in] | img | the source image |
Definition at line 177 of file CRNImageGray.h.
ImageBW crn::Sauvola | ( | const Image< T > & | img, |
size_t | halfwin, | ||
double | k = 0.5 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Creates a BW image using Sauvola's algorithm the binarisation use a threshold on a square window of neighbouring pixels the threshold t is calculated by
t = m * (1 + k * (s / R - 1))
[in] | img | the image to binarize |
[in] | halfwin | size of the square window of neighbouring pixels, from the border of the window to the central pixel |
[in] | k | parameter k |
Definition at line 282 of file CRNImageGray.h.
|
noexcept |
Replaces the pixels with their square root.
Replaces the pixels with their square root
[in] | img | the image to modify |
Definition at line 507 of file CRNImageGray.cpp.
size_t crn::StrokesHeight | ( | const Image< T > & | img, |
size_t | maxval = 50 , |
||
size_t | defaultval = 0 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Computes the mean stroke height
[in] | img | the image to binarize |
[in] | maxval | if the mean stroke height is > maxval, then defaultval is returned |
[in] | defaultval | the value returned if no mean stroke height can be computed |
Definition at line 131 of file CRNImageGray.h.
size_t crn::StrokesWidth | ( | const Image< T > & | img, |
size_t | maxval = 50 , |
||
size_t | defaultval = 0 , |
||
typename std::enable_if< std::is_arithmetic< T >::value >::type * | dummy = nullptr |
||
) |
Computes the mean stroke width
[in] | img | the image to binarize |
[in] | maxval | if the mean stroke width is > maxval, then defaultval is returned |
[in] | defaultval | the value returned if no mean stroke width can be computed |
Definition at line 90 of file CRNImageGray.h.
ImageBW crn::Threshold | ( | const Image< T > & | img, |
T | thresh, | ||
CMP | cmp = std::less<T>{} |
||
) |
Creates a BW image using a fixed threshold. Pixels strictly inferior to the threshold become black, the others white.
[in] | img | the image to binarize |
[in] | thresh | the threshold |
Definition at line 204 of file CRNImageGray.h.
Computes the vertical projection.
Computes the vertical projection
Definition at line 583 of file CRNImageGray.cpp.