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 | Static Public Member Functions | List of all members
crn::MatrixInt Class Reference

Integer matrix class. More...

#include <CRNMatrixInt.h>

+ Inheritance diagram for crn::MatrixInt:
+ Collaboration diagram for crn::MatrixInt:

Public Member Functions

 MatrixInt (const Matrix< int > &m)
 
 MatrixInt (Matrix< int > &&m)
 
 MatrixInt (const MatrixInt &)=default
 
 MatrixInt (MatrixInt &&)=default
 
virtual ~MatrixInt () override=default
 Destructor. More...
 
MatrixIntoperator= (const MatrixInt &)=default
 
MatrixIntoperator= (MatrixInt &&)=default
 
- Public Member Functions inherited from crn::Matrix< int >
 Matrix (size_t nrow, size_t ncol, const int &value=int(0))
 Constructor. More...
 
 Matrix (const std::vector< std::vector< int >> &m)
 Constructor from std::vector matrix. More...
 
 Matrix (const std::vector< int > &vect, Orientation ori=Orientation::VERTICAL)
 Constructor from std::vector 1D vector. More...
 
 Matrix (std::vector< int > &&vect, Orientation ori=Orientation::VERTICAL)
 Constructor from std::vector 1D vector. More...
 
 Matrix (const Matrix &)=default
 
 Matrix (const Matrix< Y > &m)
 
 Matrix (Matrix &&)=default
 
virtual ~Matrix () override=default
 Destructor. More...
 
Matrixoperator= (const Matrix &)=default
 
Matrixoperator= (Matrix &&)=default
 
void Swap (Matrix &m)
 
size_t GetRows () const noexcept
 Returns the number of rows. More...
 
size_t GetCols () const noexcept
 Returns the number of columns. More...
 
const int & At (size_t pos) const noexcept
 
int & At (size_t pos) noexcept
 
const int & At (size_t r, size_t c) const noexcept
 
int & At (size_t r, size_t c) noexcept
 
void SetAll (const int &v)
 Set all elements. More...
 
void Negative ()
 Change sign for all elements. More...
 
void SetRow (size_t r, const std::vector< int > &row)
 Sets the values of a row. More...
 
void SetColum (size_t c, const std::vector< int > &col)
 Sets the values of a column. More...
 
void IncreaseElement (size_t r, size_t c, const int &delta)
 Increases the value of an element. More...
 
void IncreaseRow (size_t r, const int &v)
 Increase one row from matrix. More...
 
void IncreaseColumn (size_t c, const int &v)
 Increase one column from matrix. More...
 
Matrixoperator+= (const Matrix &m)
 
Matrixoperator-= (const Matrix &m)
 
Matrixoperator*= (const Matrix &m)
 
Matrixoperator*= (double d)
 Scaling. More...
 
bool operator== (const Matrix &m) const
 
bool operator!= (const Matrix &m) const
 
Matrixoperator/= (double d)
 Scaling. More...
 
void MultRow (size_t r, double v)
 Scale one row from matrix. More...
 
void MultColumn (size_t c, double v)
 Scale one column from matrix. More...
 
void CenterColumns ()
 Centers all columns by subtracting the mean for each column. More...
 
void ReduceColumns (bool centered=true)
 Reduces all columns by dividing by the standard deviation of each column. More...
 
void SwapRows (size_t r1, size_t r2)
 Swap two rows in matrix. More...
 
void SwapColumns (size_t c1, size_t c2)
 Swap two columns in matrix. More...
 
void NormalizeForConvolution ()
 Normalizes the matrix to be used for convolution. More...
 
TypeInfo< int >::SumType CumulateCells () const
 
int GetMin () const
 
int GetMax () const
 
std::pair< size_t, size_t > Argmin () const
 
std::pair< size_t, size_t > Argmax () const
 
Matrix MakeTranspose ()
 Create transposition. More...
 
virtual MatrixTranspose ()
 Inplace transposition. More...
 
Matrix MakeRowAsColumn (size_t r) const
 Creates a column matrix from a row. More...
 
Matrix MakeRow (size_t r) const
 Extract a row from current matrix. More...
 
Matrix MakeColumn (size_t k) const
 Extracts one column from matrix. More...
 
size_t ArgmaxInRow (size_t r) const
 Returns the row index of the maximal element in a row. More...
 
size_t ArgmaxInColumn (size_t c) const
 Returns the row index of the maximal element in a column. More...
 
size_t CountNullCellsInRow (size_t r) const
 Counts null cells in row. More...
 
size_t CountNullCellsInColumn (size_t c) const
 Counts null cells in column. More...
 
size_t CountNullCells () const
 
Matrix MakeColumnMeans () const
 
Matrix MakeColumnDeviations (const Matrix &means) const
 
Matrix MakeColumnDeviations (bool zero_means=false) const
 standard deviation of patterns stored as the rows of a data matrix More...
 
Matrix MakeCovariance () const
 
int * operator[] (size_t r)
 Returns a row. More...
 
const int * operator[] (size_t r) const
 Returns a row. More...
 
const std::vector< int > & Std () const &noexcept
 
std::vector< int > Std ()&&
 
IMG ToImage () const
 Converts to image. More...
 
String ToString () const
 Prints matrix into a string. More...
 
- Public Member Functions inherited from crn::Object
virtual ~Object ()=default
 

Static Public Member Functions

static MatrixInt NewGaussian (double sigma)
 Creates a Gaussian mask given standard deviation. More...
 
static MatrixInt NewGaussian3 ()
 Creates a 3x3 Gaussian mask. More...
 
static MatrixInt NewGaussianSobelX (double sigma)
 Creates a Gaussian Sobel X derivation mask. More...
 
static MatrixInt NewGaussianSobelY (double sigma)
 Creates a Gaussian Sobel Y derivation mask. More...
 
static MatrixInt NewSobelX ()
 Creates a Sobel X derivation mask. More...
 
static MatrixInt NewSobelY ()
 Creates a Sobel Y derivation mask. More...
 
static MatrixInt NewD4DT1 ()
 Creates the first D4 DT mask. More...
 
static MatrixInt NewD4DT2 ()
 Creates the second D4 DT mask. More...
 
static MatrixInt NewD8DT1 ()
 Creates the first D8 DT mask. More...
 
static MatrixInt NewD8DT2 ()
 Creates the second D8 DT mask. More...
 
static MatrixInt NewChamferDT1 ()
 Creates the first chamfer DT mask. More...
 
static MatrixInt NewChamferDT2 ()
 Creates the second chamfer DT mask. More...
 

Additional Inherited Members

- Protected Types inherited from crn::Matrix< int >
using datatype = std::vector< int >
 
- Protected Member Functions inherited from crn::Matrix< int >
bool areValidIndexes (size_t r, size_t c) const
 checks the validity of indexes More...
 
- Protected Attributes inherited from crn::Matrix< int >
datatype data
 
size_t rows
 
size_t cols
 

Detailed Description

Integer matrix class.

Matrix contening integers

Author
Yann LEYDIER
Date
23 August 2006
Version
0.3

Definition at line 40 of file CRNMatrixInt.h.

Constructor & Destructor Documentation

crn::MatrixInt::MatrixInt ( const Matrix< int > &  m)
inline

Definition at line 44 of file CRNMatrixInt.h.

crn::MatrixInt::MatrixInt ( Matrix< int > &&  m)
inline

Definition at line 45 of file CRNMatrixInt.h.

crn::MatrixInt::MatrixInt ( const MatrixInt )
default
crn::MatrixInt::MatrixInt ( MatrixInt &&  )
default
virtual crn::MatrixInt::~MatrixInt ( )
overridevirtualdefault

Destructor.

Member Function Documentation

MatrixInt MatrixInt::NewChamferDT1 ( )
static

Creates the first chamfer DT mask.

Create the first chamfer DT mask

Returns
a new matrix

Definition at line 317 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewChamferDT2 ( )
static

Creates the second chamfer DT mask.

Create the second chamfer DT mask

Returns
a new matrix

Definition at line 332 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewD4DT1 ( )
static

Creates the first D4 DT mask.

Create the first D4 DT mask

Returns
a new matrix

Definition at line 259 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewD4DT2 ( )
static

Creates the second D4 DT mask.

Create the second D4 DT mask

Returns
a new matrix

Definition at line 272 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewD8DT1 ( )
static

Creates the first D8 DT mask.

Create the first D8 DT mask

Returns
a new matrix

Definition at line 286 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewD8DT2 ( )
static

Creates the second D8 DT mask.

Create the second D8 DT mask

Returns
a new matrix

Definition at line 301 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewGaussian ( double  sigma)
static

Creates a Gaussian mask given standard deviation.

Create a Gaussian mask given standard deviation

Exceptions
ExceptionDomainsigma is negative
Parameters
[in]sigmathe standard deviation of the Gaussian
Returns
a new matrix

Definition at line 44 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewGaussian3 ( )
static

Creates a 3x3 Gaussian mask.

Create a 3x3 Gaussian mask

Returns
a new matrix

Definition at line 90 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewGaussianSobelX ( double  sigma)
static

Creates a Gaussian Sobel X derivation mask.

Create a Gaussian Sobel X derivation mask

Exceptions
ExceptionDomainsigma is negative
Parameters
[in]sigmathe standard deviation of the Gaussian
Returns
a new matrix

Definition at line 116 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewGaussianSobelY ( double  sigma)
static

Creates a Gaussian Sobel Y derivation mask.

Create a Gaussian Sobel Y derivation mask

Exceptions
ExceptionDomainsigma is negative
Parameters
[in]sigmathe standard deviation of the Gaussian
Returns
a new matrix

Definition at line 171 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewSobelX ( )
static

Creates a Sobel X derivation mask.

Create a Sobel X derivation mask

Returns
a new matrix

Definition at line 221 of file CRNMatrixInt.cpp.

MatrixInt MatrixInt::NewSobelY ( )
static

Creates a Sobel Y derivation mask.

Create a Sobel Y derivation mask

Returns
a new matrix

Definition at line 240 of file CRNMatrixInt.cpp.

MatrixInt& crn::MatrixInt::operator= ( const MatrixInt )
default
MatrixInt& crn::MatrixInt::operator= ( MatrixInt &&  )
default

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