libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
crn::ImageGradient Class Reference

Gradient image in polar form. More...

#include <CRNImageGradient.h>

+ Inheritance diagram for crn::ImageGradient:
+ Collaboration diagram for crn::ImageGradient:

Public Member Functions

 ImageGradient (const ImageGradient &)=default
 
 ImageGradient (ImageGradient &&)=default
 
ImageGradientoperator= (const ImageGradient &)=default
 
ImageGradientoperator= (ImageGradient &&)=default
 
virtual ~ImageGradient () override
 
unsigned int GetMinModule () const noexcept
 Returns the module significance threshold. More...
 
void SetMinModule (unsigned int m)
 Sets the module significance threshold. More...
 
unsigned int AutoMinModule (const ImageGray &img)
 Computes the module significance threshold. More...
 
bool IsSignificant (size_t i) const
 Tests if a pixel has a significant gradient. More...
 
bool IsSignificant (size_t x, size_t y) const
 Tests if a pixel has a significant gradient. More...
 
ImageGray MakeImageGray () const
 Converts to a gray image. More...
 
ImageRGB MakeImageRGB (bool thres=false) const
 Converts to a rgb image. More...
 
ImageGray MakeCurvature () const
 Creates an image representing the curvature of the gradients. More...
 
ImageBW MakeMask () const
 Create a mask of the gradients' module. More...
 
double GetHRun () const noexcept
 Estimates the mean character width. More...
 
double GetVRun () const noexcept
 Estimates the mean character height. More...
 
- Public Member Functions inherited from crn::Image< pixel::Polar2D< unsigned int, Angle< ByteAngle > > >
 Image (size_t w, size_t h, pixel_type val=pixel_type(0))
 Constructor. More...
 
 Image ()
 Default constructor. More...
 
 Image (size_t w, size_t h, const pixel_type *data)
 Constructor from data. More...
 
 Image (const Image &img)=default
 Copy constructor. More...
 
 Image (const Image< Y > &img)
 Copy constructor. More...
 
 Image (const Image< typename BoolNotBool< pixel::Polar2D< unsigned int, Angle< ByteAngle > > >::type > &img)
 Copy constructor. More...
 
 Image (const Image< Y > &img, const Rect &bbox)
 Crop constructor. More...
 
 Image (const Image< typename BoolNotBool< pixel::Polar2D< unsigned int, Angle< ByteAngle > > >::type > &img, const Rect &bbox)
 Crop constructor. More...
 
 Image (Image &&img)=default
 Move constructor. More...
 
virtual ~Image () override=default
 Destructor. More...
 
Imageoperator= (const Image &img)=default
 Copy operator. More...
 
Imageoperator= (const Image< Y > &img)
 Copy operator. More...
 
Imageoperator= (const Image< typename BoolNotBool< pixel::Polar2D< unsigned int, Angle< ByteAngle > > >::type > &img)
 Copy operator. More...
 
Imageoperator= (Image &&img)=default
 Move operator. More...
 
void Assign (const Image< Y > &img)
 Force copy operator (pixel cast) More...
 
virtual std::unique_ptr
< ImageBase
Clone () const override
 
void Swap (Image &other)
 Swaps two images. More...
 
virtual void SavePNG (const Path &fname) const override
 Saves as PNG file. More...
 
virtual void SaveJPEG (const Path &fname, unsigned int qual) const override
 Saves as JPEG file. More...
 
MAT ToMatrix () const
 Converts to matrix. More...
 
std::vector< pixel_type >::iterator begin ()
 
std::vector< pixel_type >
::const_iterator 
begin () const
 
std::vector< pixel_type >::iterator end ()
 
std::vector< pixel_type >
::const_iterator 
end () const
 
std::vector< pixel_type >
::const_iterator 
cbegin () const
 
std::vector< pixel_type >
::const_iterator 
cend () const
 
std::vector< pixel_type >::pointer GetPixels () noexcept
 Gets a pointer to the pixels. More...
 
std::vector< pixel_type >
::const_pointer 
GetPixels () const noexcept
 Gets a const pointer to the pixels. More...
 
std::vector< pixel_type >
::reference 
At (size_t x, size_t y) noexcept
 Returns a reference to a pixel. More...
 
std::vector< pixel_type >
::reference 
At (size_t offset) noexcept
 Returns a reference to a pixel. More...
 
std::vector< pixel_type >
::const_reference 
At (size_t x, size_t y) const noexcept
 Returns a reference to a pixel. More...
 
std::vector< pixel_type >
::const_reference 
At (size_t offset) const noexcept
 Returns a reference to a pixel. More...
 
bool operator== (const Image &other) const
 Tests equality. More...
 
bool operator!= (const Image &other) const
 Tests equality. More...
 
Imageoperator+= (const Image &img)
 Adds another image. More...
 
Imageoperator-= (const Image &img)
 Subtracts another image. More...
 
Imageoperator*= (double f)
 Multiplies all pixels. More...
 
Imageoperator*= (const Image &img)
 Multiplies with another image's pixels. More...
 
Imageoperator/= (const Image &img)
 Divides by another image's pixels. More...
 
void Negative ()
 Negative. More...
 
void Complement (pixel_type maxval=std::numeric_limits< pixel_type >::max())
 Complement. More...
 
void Blit (const Image< Y > &src, const Rect &srczone, size_t dx, size_t dy)
 Copies a part of an image. More...
 
void FloodFill (size_t x, size_t y, const pixel_type &val, crn::DistanceType dist=crn::DistanceType::D4)
 Flood fills a portion of the image. More...
 
void ScanFill (size_t x, size_t y, const pixel_type &val, crn::DistanceType dist=crn::DistanceType::D4)
 Fills a portion of the image. More...
 
void DrawRect (const Rect &r, pixel_type color, bool filled=false)
 Draws a rectangle using a specified color. More...
 
void DrawLine (size_t x1, size_t y1, size_t x2, size_t y2, pixel_type color)
 Draws a line using a specified color. More...
 
virtual void ScaleToSize (size_t w, size_t h) override
 Scales the image. More...
 
void Flip (const Orientation &ori)
 Flips the image. More...
 
void Dilate (const MatrixInt &strel, CMP cmp=std::less< pixel_type >{})
 Morphological dilatation. More...
 
void Erode (const MatrixInt &strel, CMP cmp=std::less< pixel_type >{})
 Morphological erosion. More...
 
void FastDilate (size_t halfwin, size_t index=0, CMP cmp=std::less< pixel_type >{})
 Morphological dilatation. More...
 
void FastErode (size_t halfwin, size_t index=0, CMP cmp=std::less< pixel_type >{})
 Morphological erosion. More...
 
void Convolve (const MatrixDouble &mat)
 Convolution. More...
 
void GaussianBlur (double sigma)
 Gaussian blur. More...
 
- Public Member Functions inherited from crn::ImageBase
virtual ~ImageBase ()
 
 ImageBase (size_t w, size_t h)
 
 ImageBase (const ImageBase &)=default
 
 ImageBase (ImageBase &&)=default
 
ImageBaseoperator= (const ImageBase &)=default
 
ImageBaseoperator= (ImageBase &&)=default
 
size_t GetWidth () const noexcept
 
size_t GetHeight () const noexcept
 
Rect GetBBox () const noexcept
 
size_t Size () const noexcept
 

Additional Inherited Members

- Public Types inherited from crn::Image< pixel::Polar2D< unsigned int, Angle< ByteAngle > > >
using pixel_type = pixel::Polar2D< unsigned int, Angle< ByteAngle > >
 
- Protected Attributes inherited from crn::Image< pixel::Polar2D< unsigned int, Angle< ByteAngle > > >
std::vector< pixel_typepixels
 
- Protected Attributes inherited from crn::ImageBase
size_t width
 
size_t height
 

Detailed Description

Gradient image in polar form.

This class is for gradient images, in polar form

Author
Yann LEYDIER
Date
August 2007
Version
0.4

Definition at line 39 of file CRNImageGradient.h.

Constructor & Destructor Documentation

crn::ImageGradient::ImageGradient ( const ImageGradient )
default
crn::ImageGradient::ImageGradient ( ImageGradient &&  )
default
virtual crn::ImageGradient::~ImageGradient ( )
inlineoverridevirtual

Definition at line 67 of file CRNImageGradient.h.

Member Function Documentation

unsigned int ImageGradient::AutoMinModule ( const ImageGray img)

Computes the module significance threshold.

Computes the module significance threshold

Parameters
[in]imgan image representing the same view
Returns
the new threshold value

Definition at line 34 of file CRNImageGradient.cpp.

double ImageGradient::GetHRun ( ) const
noexcept

Estimates the mean character width.

Estimates the mean character width

Returns
the estimation of the mean character width

Definition at line 264 of file CRNImageGradient.cpp.

unsigned int crn::ImageGradient::GetMinModule ( ) const
inlinenoexcept

Returns the module significance threshold.

Definition at line 70 of file CRNImageGradient.h.

double ImageGradient::GetVRun ( ) const
noexcept

Estimates the mean character height.

Estimates the mean character width

Returns
the estimation of the mean character height

Definition at line 406 of file CRNImageGradient.cpp.

bool crn::ImageGradient::IsSignificant ( size_t  i) const
inline

Tests if a pixel has a significant gradient.

Warning
no bound checking is performed
Parameters
[in]offsetthe offset of the pixel
Returns
true if the pixel has a significant gradient module

Definition at line 81 of file CRNImageGradient.h.

bool crn::ImageGradient::IsSignificant ( size_t  x,
size_t  y 
) const
inline

Tests if a pixel has a significant gradient.

Warning
no bound checking is performed
Parameters
[in]xthe abscissa of the pixel
[in]ythe ordinate of the pixel
Returns
true if the pixel has a significant gradient module

Definition at line 88 of file CRNImageGradient.h.

ImageGray ImageGradient::MakeCurvature ( ) const

Creates an image representing the curvature of the gradients.

Creates an image representing the curvature of the gradients.

A null curvature is assigned to pixels with a gradient module lower than the threshold.

Returns
an image with gray levels representing the curvature (0 = straight, 255 = half turn)

Definition at line 117 of file CRNImageGradient.cpp.

ImageGray ImageGradient::MakeImageGray ( ) const

Converts to a gray image.

Converts to a gray image

Returns
the newly created image

Definition at line 67 of file CRNImageGradient.cpp.

ImageRGB ImageGradient::MakeImageRGB ( bool  thres = false) const

Converts to a rgb image.

Converts to a rgb image

Parameters
[in]thresshall we threshold the output?
Returns
the newly created image

Definition at line 85 of file CRNImageGradient.cpp.

ImageBW ImageGradient::MakeMask ( ) const

Create a mask of the gradients' module.

Returns
a mask of the gradients' module

Definition at line 249 of file CRNImageGradient.cpp.

ImageGradient& crn::ImageGradient::operator= ( const ImageGradient )
default
ImageGradient& crn::ImageGradient::operator= ( ImageGradient &&  )
default
void crn::ImageGradient::SetMinModule ( unsigned int  m)
inline

Sets the module significance threshold.

Definition at line 72 of file CRNImageGradient.h.


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