Functions | |
template<typename T> | |
std::deque< T > | mimas::gaussBlurFilter (T sigma, T maxError=(T)(1.0/256.0)) |
Compute gauss-bell. | |
template<typename T> | |
boost::multi_array< T, 2 > | mimas::gaussBlur (const boost::const_multi_array_ref< T, 2 > &x, T sigma, T maxError) |
Blur 2-D array. | |
template<typename T> | |
image< T > | mimas::gaussBlur (const image< T > &x, T sigma, T maxError=(T)(1.0/256.0)) |
Blur image. | |
template<typename T> | |
std::deque< T > | mimas::gaussGradientFilter (T sigma, T maxError=(T)(1.0/256.0)) |
Compute gauss-gradient. | |
template<typename T> | |
boost::multi_array< T, 2 > | mimas::gaussGradientX (const boost::const_multi_array_ref< T, 2 > &x, T sigma, T maxError) |
Take x-gradient of 2-D array. | |
template<typename T> | |
image< T > | mimas::gaussGradientX (const image< T > &x, T sigma, T maxError=(T)(1.0/256.0)) |
Take x-gradient of 2-D image. | |
template<typename T> | |
boost::multi_array< T, 2 > | mimas::gaussGradientY (const boost::const_multi_array_ref< T, 2 > &x, T sigma, T maxError) |
Take y-gradient of 2-D array. | |
template<typename T> | |
image< T > | mimas::gaussGradientY (const image< T > &x, T sigma, T maxError=(T)(1.0/256.0)) |
Take y-gradient of 2-D image. | |
template<typename T> | |
image< T > | mimas::gaussGradientSqr (const image< T > &im, T sigma, T maxError=(T)(1.0/256.0)) |
Square of gradient-norm. | |
template<typename T> | |
image< T > | mimas::gaussGradientNorm (const image< T > &im, T sigma, T maxError=(T)(1.0/256.0)) |
Gradient-norm. |
The filter-parameter can be choosen and the size of the filter is computed by choosing an upper bound for the approximation-error.
The following example demonstrates how to blur an image:
// // stumeikle // canny (with postprocessing) example // #include <fstream> #include <GL/glut.h> #include <iostream> #include <vector> #include "image.h" #include "image_fileinput.h" #include "image_mesaoutput.h" #include "rgba.h" #include "property_image.h" #include "gauss.h" using namespace std; using namespace mimas; int main(int argc, char **argv) { int retVal = 0; try { // Initialise GLUT. glutInit( &argc, argv ); MMERROR( argc == 2, mimasexception, , "Syntax: " << argv[0] << " <image-file>" ); image< unsigned char > input; x11_display display; image_mesaoutput< unsigned char > window( &display ); ifstream file( argv[1], ios::binary ); MMERROR( file >> input, mimasexception, , "Error loading file \"" << argv[1] << "\"." ); window << input << mimas::delay( 3000 ) << image< unsigned char >( gaussBlur< float > ( input, 10.0f, 4.0f / 256.0f ) ) << mimas::wait( 3000 ); } catch ( exception &e ) { cerr << e.what() << endl; retVal = 1; }; return retVal; }
image< T > mimas::gaussBlur | ( | const image< T > & | x, | |
T | sigma, | |||
T | maxError = (T)( 1.0 / 256.0 ) | |||
) |
Blur image.
Perform gaussian blur on 2-D image.
x | Input image. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
Definition at line 57 of file gauss.h.
References mimas::const_image_ref< T, T * >::getHeight(), mimas::const_image_ref< T, T * >::getWidth(), and mimas::image_ref< T >::rawData().
Here is the call graph for this function:
boost::multi_array< T, 2 > mimas::gaussBlur | ( | const boost::const_multi_array_ref< T, 2 > & | x, | |
T | sigma, | |||
T | maxError | |||
) |
Blur 2-D array.
Perform gaussian blur on 2-D array.
x | Input array. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
std::deque< T > mimas::gaussBlurFilter | ( | T | sigma, | |
T | maxError = (T)(1.0/256.0) | |||
) |
Compute gauss-bell.
The values of the cells are computed by using differences of the integral of the gauss-function:
The coefficients are normalised afterwards such that the sum of all elements of the filter is .
sigma | Standard deviation of gauss-distribution. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
std::deque< T > mimas::gaussGradientFilter | ( | T | sigma, | |
T | maxError = (T)(1.0/256.0) | |||
) |
Compute gauss-gradient.
The values of the cells are computed by using differences of the integral (the gauss-function):
The coefficients are normalised afterwards such that the sum of the square of all elements of the filter is .
sigma | Standard deviation of gauss-distribution. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
image< T > mimas::gaussGradientNorm | ( | const image< T > & | im, | |
T | sigma, | |||
T | maxError = (T)( 1.0 / 256.0 ) | |||
) |
Gradient-norm.
Compute gradient-norm for 2-D image
im | Input image. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
Definition at line 148 of file gauss.h.
References mimas::gaussGradientSqr().
Here is the call graph for this function:
image< T > mimas::gaussGradientSqr | ( | const image< T > & | im, | |
T | sigma, | |||
T | maxError = (T)( 1.0 / 256.0 ) | |||
) |
Square of gradient-norm.
Compute square of gradient-norm for 2-D image
im | Input image. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
Definition at line 132 of file gauss.h.
References mimas::gaussGradientX(), and mimas::gaussGradientY().
Referenced by mimas::gaussGradientNorm().
Here is the call graph for this function:
image< T > mimas::gaussGradientX | ( | const image< T > & | x, | |
T | sigma, | |||
T | maxError = (T)(1.0/256.0) | |||
) |
Take x-gradient of 2-D image.
Compute gauss-gradient of 2-D image in x-direction.
x | Input image. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
boost::multi_array< T, 2 > mimas::gaussGradientX | ( | const boost::const_multi_array_ref< T, 2 > & | x, | |
T | sigma, | |||
T | maxError | |||
) |
Take x-gradient of 2-D array.
Compute gauss-gradient of 2-D array in x-direction.
x | Input array. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
Referenced by mimas::gaussGradientSqr().
image< T > mimas::gaussGradientY | ( | const image< T > & | x, | |
T | sigma, | |||
T | maxError = (T)(1.0/256.0) | |||
) |
Take y-gradient of 2-D image.
Compute gauss-gradient of 2-D image in y-direction.
x | Input image. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
boost::multi_array< T, 2 > mimas::gaussGradientY | ( | const boost::const_multi_array_ref< T, 2 > & | x, | |
T | sigma, | |||
T | maxError | |||
) |
Take y-gradient of 2-D array.
Compute gauss-gradient of 2-D array in y-direction.
x | Input array. | |
sigma | Standard deviation. | |
maxError | Maximum error boundary (relative to range of pixel-values). |
Referenced by mimas::gaussGradientSqr().