KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Friends | List of all members
kjb::Filter Class Reference

Filter class. More...

#include <i_filter.h>

Public Types

typedef Matrix::Value_type Value_type
 

Public Member Functions

 Filter (int rows, int cols)
 Construct filter of specified size, defaults to zero by zero. More...
 
 Filter (const Matrix &src)
 Construct filter from matrix. More...
 
 Filter (const char *fname)
 Read filter from a named file. More...
 
 Filter (const std::string &fname)
 Read filter from a named file. More...
 
 Filter (const Filter &src)
 Copy ctor, performs a deep copy. More...
 
 ~Filter ()
 Destroy filter's memory. More...
 
void swap (Filter &other)
 Swap the implementation of two filters. More...
 
int get_num_rows () const
 Return the number of rows in the filter. More...
 
int get_num_cols () const
 Return the number of columns in the filter. More...
 
Filteroperator= (const kjb::Matrix &src)
 Assignment of a matrix to a filter. More...
 
Filteroperator= (const Filter &src)
 Deep copy assignment. More...
 
Value_typeoperator() (int row, int col)
 Lvalue value access at given row & column, no bounds-checking. More...
 
Value_type operator() (int row, int col) const
 Rvalue value access at given row & column, no bounds-checking. More...
 
void check_bounds (int row, int col) const
 Test whether row, column coordinates are valid. More...
 
Value_typeat (int row, int col)
 Access value lvalue at row, column coordinates. More...
 
Value_type at (int row, int col) const
 Access value rvalue at row, column coordinates. More...
 
void write (std::string fname)
 Write to a file. More...
 

Friends

Image operator* (const Image &, const Filter &)
 Convolve an image with a filter. More...
 
Matrix operator* (const Matrix &, const Filter &)
 

Detailed Description

Filter class.

This class represents an image filter. It is meant to be used to convolve with other filters and with images. The reason I made this class (as opposed to simply using a Matrix) is to be able to overload the * operator to use as a convolution. More generally, a filter is not really a matrix, but a signal, so it should not have the functionality of a matrix.

Member Typedef Documentation

Constructor & Destructor Documentation

kjb::Filter::Filter ( int  rows,
int  cols 
)
inline

Construct filter of specified size, defaults to zero by zero.

kjb::Filter::Filter ( const Matrix src)
inline

Construct filter from matrix.

kjb::Filter::Filter ( const char *  fname)
inline

Read filter from a named file.

kjb::Filter::Filter ( const std::string &  fname)
inline

Read filter from a named file.

kjb::Filter::Filter ( const Filter src)
inline

Copy ctor, performs a deep copy.

kjb::Filter::~Filter ( )
inline

Destroy filter's memory.

Member Function Documentation

Value_type& kjb::Filter::at ( int  row,
int  col 
)
inline

Access value lvalue at row, column coordinates.

Exceptions
Index_out_of_boundsif the coordinates are out of bounds.
Value_type kjb::Filter::at ( int  row,
int  col 
) const
inline

Access value rvalue at row, column coordinates.

Exceptions
Index_out_of_boundsif the coordinates are out of bounds.
void kjb::Filter::check_bounds ( int  row,
int  col 
) const
inline

Test whether row, column coordinates are valid.

Exceptions
Index_out_of_boundsif the coordinates are out of bounds.
int kjb::Filter::get_num_cols ( ) const
inline

Return the number of columns in the filter.

int kjb::Filter::get_num_rows ( ) const
inline

Return the number of rows in the filter.

Value_type& kjb::Filter::operator() ( int  row,
int  col 
)
inline

Lvalue value access at given row & column, no bounds-checking.

Value_type kjb::Filter::operator() ( int  row,
int  col 
) const
inline

Rvalue value access at given row & column, no bounds-checking.

Filter& kjb::Filter::operator= ( const kjb::Matrix src)
inline

Assignment of a matrix to a filter.

Filter& kjb::Filter::operator= ( const Filter src)
inline

Deep copy assignment.

void kjb::Filter::swap ( Filter other)
inline

Swap the implementation of two filters.

void kjb::Filter::write ( std::string  fname)
inline

Write to a file.

Friends And Related Function Documentation

Image operator* ( const Image ,
const Filter  
)
friend

Convolve an image with a filter.

Matrix operator* ( const Matrix in,
const Filter mask 
)
friend

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