AlgoPlus v0.1.0
Loading...
Searching...
No Matches
Image Class Reference

Public Member Functions

 Image (std::vector< std::vector< int32_t > > img_pass={})
 image default constructor
 
 Image (int height, int width)
 Image secondary constructor.
 
int _height () const
 _height function
 
int _width () const
 width function
 
std::vector< std::vector< int32_t > > get_2d_array () const
 get_2d_array function
 
int get_point (const int x, const int y) const
 get_point function
 
void set_point (int x, int y, int val)
 set_point function
 
template<typename T>
void add_2_point (const int x, const int y, const T val)
 add_2_point function
 
int32_t get_point (const int x, const int y)
 get_point function
 
bool binary () const
 binary function. Check if an image is black and white
 
template<typename T>
Image add (const T img2) const
 add function adds the img2 to img
 
template<typename T>
Image sub (const T img2) const
 sub function adds the img2 to img
 
template<typename T>
Image mul (const T img2) const
 mul function multiplies the img2 to img
 
template<typename T>
Image apply_filter2d (std::vector< std::vector< T > > &filter) const
 apply_filter2d function
 

Friends

std::ostream & operator<< (std::ostream &out, const Image &img)
 overloaded operator << for Image class
 

Constructor & Destructor Documentation

◆ Image() [1/2]

Image::Image ( std::vector< std::vector< int32_t > > img_pass = {})
inlineexplicit

image default constructor

Parameters
img_passpassed image(default empty)

◆ Image() [2/2]

Image::Image ( int height,
int width )
inlineexplicit

Image secondary constructor.

Parameters
heightthe input height
widththe input width

Member Function Documentation

◆ _height()

int Image::_height ( ) const
inline

_height function

Returns
int: the height of the image

◆ _width()

int Image::_width ( ) const
inline

width function

Returns
int: the width of the image

◆ add()

template<typename T>
Image Image::add ( const T img2) const
inline

add function adds the img2 to img

Parameters
img2the image you want to add to the img
Returns
vector<vector<T> > the resulted image

◆ add_2_point()

template<typename T>
void Image::add_2_point ( const int x,
const int y,
const T val )
inline

add_2_point function

Parameters
xfirst coordinate
ysecond coordinate
valthe value you want to add to the point img(x, y)

◆ apply_filter2d()

template<typename T>
Image Image::apply_filter2d ( std::vector< std::vector< T > > & filter) const
inline

apply_filter2d function

Parameters
filter3x3 kernel to be applied to the image
Returns
vector<vector<T> > the resulted image

◆ binary()

bool Image::binary ( ) const
inline

binary function. Check if an image is black and white

Returns
true if the image is black and white
false otherwise

◆ get_2d_array()

std::vector< std::vector< int32_t > > Image::get_2d_array ( ) const
inline

get_2d_array function

Returns
vector<vector<int32_t> >: the 2d array of the image

◆ get_point() [1/2]

int32_t Image::get_point ( const int x,
const int y )
inline

get_point function

Parameters
xfirst coordinate
ysecond coordinate
Returns
int32_t: the value of img(x, y)

◆ get_point() [2/2]

int Image::get_point ( const int x,
const int y ) const
inline

get_point function

Parameters
xthe first dimension
ythe second dimension
Returns
int: the value of Img(x, y)

◆ mul()

template<typename T>
Image Image::mul ( const T img2) const
inline

mul function multiplies the img2 to img

Parameters
img2the image you want to subtract from the img
Returns
vector<vector<T> > the resulted image

◆ set_point()

void Image::set_point ( int x,
int y,
int val )
inline

set_point function

Parameters
xthe first dimension
ythe second dimension

◆ sub()

template<typename T>
Image Image::sub ( const T img2) const
inline

sub function adds the img2 to img

Parameters
img2the image you want to subtract from the img
Returns
vector<vector<int32_t> > the resulted image

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