AliceVision
Photogrammetric Computer Vision Framework
Public Types | Public Member Functions | Friends | List of all members
aliceVision::image::Image< T > Class Template Reference

Public Types

typedef T Tpixel
 
typedef Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Base
 

Public Member Functions

 Image ()
 Default constructor. More...
 
 Image (int width, int height, bool fInit=false, const T val=T())
 Full constructor. More...
 
 Image (const Base &I)
 Copy constructor. More...
 
 Image (Base &&src)
 Move constructor. More...
 
Imageoperator= (const Base &I)
 Assignment operator. More...
 
virtual ~Image ()=default
 destructor
 
void resize (int width, int height, bool fInit=true, const T val=T())
 Change geometry of image. More...
 
int width () const
 Retrieve the width of the image. More...
 
int height () const
 Retrieve the height of the image. More...
 
int depth () const
 Return the depth in byte of the pixel. More...
 
unsigned long long int memorySize () const
 Retrieve the size in byte of the image. More...
 
int channels () const
 Return the number of channels. More...
 
const T & operator() (int y, int x) const
 constant random pixel access More...
 
T & operator() (int y, int x)
 random pixel access More...
 
const T & operator() (int i) const
 
T & operator() (int i)
 
const Base & getMat () const
 Get low level access to the internal pixel data. More...
 
Base & getMat ()
 
bool contains (int y, int x) const
 Tell if a point is inside the image. More...
 
template<class UnaryFunction >
bool perPixelOperation (UnaryFunction f)
 

Friends

template<typename T1 >
Image< T1 > operator+ (const Image< T1 > &imgA, const Image< T1 > &imgB)
 Pixelwise addition of two images. More...
 
template<typename T1 >
Image< T1 > operator- (const Image< T1 > &imgA, const Image< T1 > &imgB)
 Pixelwise subtraction of two images. More...
 

Constructor & Destructor Documentation

◆ Image() [1/4]

template<typename T >
aliceVision::image::Image< T >::Image ( )
inline

Default constructor.

Note
This create an empty image

◆ Image() [2/4]

template<typename T >
aliceVision::image::Image< T >::Image ( int  width,
int  height,
bool  fInit = false,
const T  val = T() 
)
inline

Full constructor.

Parameters
widthWidth of the image (ie number of column)
heightHeight of the image (ie number of row)
fInitTell if the image should be initialized
valIf fInit is true, set all pixel to the specified value

◆ Image() [3/4]

template<typename T >
aliceVision::image::Image< T >::Image ( const Base &  I)
inline

Copy constructor.

Parameters
ISource image

◆ Image() [4/4]

template<typename T >
aliceVision::image::Image< T >::Image ( Base &&  src)
inline

Move constructor.

Parameters
srcSource image

Member Function Documentation

◆ channels()

template<typename T >
int aliceVision::image::Image< T >::channels ( ) const
inline

Return the number of channels.

Returns
number of channels

◆ contains()

template<typename T >
bool aliceVision::image::Image< T >::contains ( int  y,
int  x 
) const
inline

Tell if a point is inside the image.

Parameters
yIndex of the row
xIndex of the column
Return values
trueIf pixel (y,x) is inside the image
falseIf pixel (y,x) is outside the image

◆ depth()

template<typename T >
int aliceVision::image::Image< T >::depth ( ) const
inline

Return the depth in byte of the pixel.

Returns
depth of the pixel (in byte)
Note
(T=unsigned char will return 1)

◆ getMat()

template<typename T >
const Base& aliceVision::image::Image< T >::getMat ( ) const
inline

Get low level access to the internal pixel data.

Returns
const reference to internal matrix data

◆ height()

template<typename T >
int aliceVision::image::Image< T >::height ( ) const
inline

Retrieve the height of the image.

Returns
Height of the image

◆ memorySize()

template<typename T >
unsigned long long int aliceVision::image::Image< T >::memorySize ( ) const
inline

Retrieve the size in byte of the image.

Returns
size of the image (in byte)
Note
We use unsigned long long integers to avoid issues with large images, which can exceed several GB.

◆ operator()() [1/2]

template<typename T >
T& aliceVision::image::Image< T >::operator() ( int  y,
int  x 
)
inline

random pixel access

Parameters
yIndex of the row
xIndex of the column
Returns
Pixel reference at position (y,x)

◆ operator()() [2/2]

template<typename T >
const T& aliceVision::image::Image< T >::operator() ( int  y,
int  x 
) const
inline

constant random pixel access

Parameters
yIndex of the row
xIndex of the column
Returns
Constant pixel reference at position (y,x)

◆ operator=()

template<typename T >
Image& aliceVision::image::Image< T >::operator= ( const Base &  I)
inline

Assignment operator.

Parameters
ISource image
Returns
Image after assignment

◆ resize()

template<typename T >
void aliceVision::image::Image< T >::resize ( int  width,
int  height,
bool  fInit = true,
const T  val = T() 
)
inline

Change geometry of image.

Parameters
widthNew width of image
heightNew height of image
fInitIndicate if new image should be initialized
valif fInit is true all pixel in the new image are set to this value

◆ width()

template<typename T >
int aliceVision::image::Image< T >::width ( ) const
inline

Retrieve the width of the image.

Returns
Width of image

Friends And Related Function Documentation

◆ operator+

template<typename T >
template<typename T1 >
Image<T1> operator+ ( const Image< T1 > &  imgA,
const Image< T1 > &  imgB 
)
friend

Pixelwise addition of two images.

Parameters
imgAFirst image
imgBSecond image
Returns
pixelwise imgA + imgB
Note
Images must have the same size

◆ operator-

template<typename T >
template<typename T1 >
Image<T1> operator- ( const Image< T1 > &  imgA,
const Image< T1 > &  imgB 
)
friend

Pixelwise subtraction of two images.

Parameters
imgAFirst image
imgBSecond image
Returns
pixelwise imgA - imgB
Note
Images must have the same size

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