STIRA  0.1
Public Member Functions | Static Public Member Functions | List of all members
stira::common::MathUtils Class Reference

A class with some handy mathematical functions. More...

#include <MathUtils.h>

Public Member Functions

 MathUtils ()
 Constructor.
 
 ~MathUtils ()
 Destructor.
 
bool SolveQuadraticEquation (double a, double b, double c, double &outSolution1, double &outSolution2)
 solves a quadratic equation a * x * x + b * x + c = 0 (real-valued case) More...
 

Static Public Member Functions

static void SwitchValues (double &a, double &b)
 switches the values for the variables a and b More...
 
static void SwitchValues (int &a, int &b)
 switches the values for the variables a and b More...
 
static double GetMin (double value1, double value2)
 returns the smallest of both input values More...
 
static double GetMax (double value1, double value2)
 returns the largest of both input values More...
 
static int CompareDoubles (const void *a, const void *b)
 compare method for two doubles, as needed by qsort More...
 
static int CompareFloats (const void *a, const void *b)
 compare method for two floats, as needed by qsort More...
 
static int CompareIntegers (const void *a, const void *b)
 compare method for two doubles, as needed by qsort More...
 
static int ClipValue (int value, int min=0, int max=255)
 Clips value to be in the range [min, max] if the user by accident switches the maximum and minimum values, this method corrects this. More...
 
static double ClipValue (double value, double min=0.0, double max=255.0)
 Clips value to be in the range [min, max] if the user by accident switches the maximum and minimum values, this method corrects this. More...
 
static bool IsBetween (double testValue, double underLimit, double upperLimit)
 Checks if a value is between a lower and an upper value. More...
 
static double ApplyModulo (double input, double modulo)
 applies modulo to number While number is larger than number, subtract modulo; While number is smaller than 0, add modulo More...
 
static void PrintBitsInInt (unsigned int i)
 prints to stdout the bits in a 32bit unsigned integer More...
 
static void PrintBitsInChar (unsigned char c)
 prints to stdout the bits in an unsigned char More...
 
static unsigned int CombineCharsInInt (unsigned char i0, unsigned char i1, unsigned char i2, unsigned char i3)
 combine 4 unsigned in one 32 bit unsigned integer [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] unsigned char c0 unsigned char c1 unsigned char c2 unsigned char c3 More...
 
static std::vector< unsigned char > SplitIntInChars (int value)
 splits a 32bit unsigned integer in a vector of 4 unsigned chars More...
 
static double ComputeArgument (double x, double y)
 computes the angle of the line from the origin to the point (x,y) More...
 
static double ToRadians (double degrees)
 converts degrees to radians More...
 
static double ToDegrees (double radians)
 converts radians to degrees More...
 
static bool SolveLinearEquation (double a, double b, double &solution)
 solves a linear equation ax + b = 0 More...
 
static bool SolveQuadraticEquation (std::complex< double > a, std::complex< double > b, std::complex< double > c, std::complex< double > &outSolution1, std::complex< double > &outSolution2)
 solves a quadratic equation a * x * x + b * x + c = 0 (complex-valued case) More...
 
static double LinearInterpolate (double x0, double y0, double x1, double y1, double x)
 Computes y value according to linear interpolation.
 
static double ComputePSNR (double MSE, double peakValue=255.0)
 Computes PSNR (Peak Signal to Noise Ratio) given the MSE (Mean Square Error) Ref: http://en.wikipedia.org/wiki/PSNR. More...
 
static double GammaCorrect (double inValue, double gamma, double rangeMin=0.0, double rangeMax=255.0)
 applies gamma correction to input value Data is for gamma correction first normalized between 0 and 1 More...
 
static double GetSteerableInterPolationCoefficient (int i, int K, double theta)
 computes steerable interpolation coefficient for angle theta Suppose B_theta(x,y) = k1(theta) * B1(x,y)) + k2(theta) * B2(x,y)) + k3(theta) * B1(x,y), with B_theta the interpolated band, ki(theta) the interpolation coefficients (i=1,2,3) and Bi(x,y) the basis bands (i=1,2,3). then this function computes ki(theta) This formulation is a generalization of the expression of Freeman and Adelson by Bart Goossens for an arbitrary number of orientations More...
 
static double Factorial (const double &inputNumber)
 help function to have an exact factorial in case the input number is a casted integer More...
 
static int ComputeIntegerPower (int myNumber, int myExponent)
 computes myNumber to the power myExponent, to prevent all that messy casting that pow() otherwise requires More...
 
static std::vector< double > GenerateGaussianSamples (double sigma)
 computes a set of points sampled regularly from the Gauss function (NOT random variables with Gaussian distribution!!) More...
 
static std::vector< Point< double > > GenerateGaussianPoints (int gaussCenterX, double sigma, bool scaleAmplitude=false, double amplitude=1)
 computes a set of Gaussian sample points The Gaussian has the peak at gaussCenterX, unity sample distance and half width 2 times sigma More...
 
static std::vector< Point< double > > GenerateGaussianPoints (std::vector< Point< double > > inPoints, int gaussCenterX, double sigma, bool scaleAmplitude, double amplitude)
 computes a set of Gaussian sample points It uses the x coordinates of inPoints to compute the function value with the peak at gaussCenterX More...
 
static double Gaussian (double x, double mu, double sigma)
 computes for a value x the value G(x) with G the Gaussian function (as used in probabilities) Reference: http://mathworld.wolfram.com/GaussianFunction.html G(x) = 1/sqrt(2*sigma*pi) * exp( (x - mu) / 2 sigma^2 ) More...
 
static double Gaussian (double x, double y, double muX, double muY, double sigmaX, double sigmaY)
 computes for a point (x,y) the value G(x,y) with G the 2D Gaussian function (as used in probabilities) Reference: http://mathworld.wolfram.com/GaussianFunction.html G(x) = 1/(2*pi*sigmaX*sigmaY) * exp( (x - muX) / (2 sigmaX^2) + (y - muY) / (2 sigmaY^2) ) More...
 
static double GaussianFirstDerivativeX1D (double x, double mu, double sigma)
 computes for a value x the value G'(x) with G' the first derivative of the Gaussian function More...
 
static double GaussianSecondDerivateX1D (double x, double mu, double sigma)
 computes for a value x the value G''(x) with G'' the second derivative of the Gaussian function More...
 
static double GaussianDx (double x, double y, double muX, double muY, double sigmaX, double sigmaY)
 computes for a point (x,y) the value of the first derivative to x of the 2D Gaussian function More...
 
static double GaussianDy (double x, double y, double muX, double muY, double sigmaX, double sigmaY)
 computes for a point (x,y) the value of the first derivative to y of the 2D Gaussian function More...
 
static double GaussianSecondDerivateX1D (double x, double y, double muX, double muY, double sigmaX, double sigmaY)
 computes for a point (x,y) the value of the second derivative to x of the 2D Gaussian function More...
 
static double GaussianD2y (double x, double y, double muX, double muY, double sigmaX, double sigmaY)
 computes for a point (x,y) the value of the second derivative to y of the 2D Gaussian function More...
 
static double GaussianDxDy (double x, double y, double muX, double muY, double sigmaX, double sigmaY)
 computes for a point (x,y) the value of the mixed first derivatives to x and y of the 2D Gaussian function More...
 
static double * ComputeCrossCorrelation (double *x, double *y, int nrSamples, int maxDelay)
 Computes cross-correlation between two signals x and y Reference: code + explanation: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/correlate/ general: http://en.wikipedia.org/wiki/Cross-correlation. More...
 
static void NormalizeVector (std::vector< double > &inVector)
 normalizes all elements of the vector passed as argument, overwriting the original values More...
 

Detailed Description

A class with some handy mathematical functions.

  1. SWITCH TWO VALUES
  2. ORDER / COMPARE STUFF / CLIP RANGE / CHECK IF IS RANGE
  3. COMBINE / SPLIT BITS
  4. STUFF RELATED TO ANGLES
  5. SOLVE LINEAR / QUADRATIC EQUATIONS
  6. COMPUTE MATHEMATICAL FUNCTION VALUE
  7. COMPUTE VALUES OF GAUSSIAN FUNCTION / DERIVATIVES
  8. COMPUTE STATISTICS

Member Function Documentation

double stira::common::MathUtils::ApplyModulo ( double  input,
double  modulo 
)
static

applies modulo to number While number is larger than number, subtract modulo; While number is smaller than 0, add modulo

Parameters
inputinput number
modulomodulo

Referenced by stira::imagetools::FractalGenerator::GetMathWidth(), and stira::imagedata::TransformColorSpace::LabtoLCH().

int stira::common::MathUtils::ClipValue ( int  value,
int  min = 0,
int  max = 255 
)
static

Clips value to be in the range [min, max] if the user by accident switches the maximum and minimum values, this method corrects this.

Parameters
minthe minimum value allowed value after clipping
valuethe value to be clipped
maxthe maximum value allowed after clipping

Referenced by stira::imagedata::Image::AddGaussianNoise(), stira::imagedata::TransformColorSpace::AdobeRGBtoXYZ(), stira::imagetools::FisheyeCorrector::ApplyCorrect(), stira::imagedata::Image::ApplyPoissonNoise(), stira::imagetools::NumberGridTools< T >::ClipValues(), stira::imagedata::GridStatistics< T >::ComputeLocalAbsoluteMean(), stira::imagedata::GridStatistics< T >::ComputeLocalCovariance(), stira::imagedata::GridStatistics< T >::ComputeLocalKurtosis(), stira::imagedata::GridStatistics< T >::ComputeLocalMean(), stira::imagedata::GridStatistics< T >::ComputeLocalVariance(), stira::filter::LocalBinaryPattern::ComputePointLBPSymHistogram(), stira::imagedata::Image::CopyImageValues(), stira::imagetools::NumberGridTools< T >::CopyValues(), stira::contrastenhance::HistogramTools::MatchHistogramValue(), stira::imagetools::NumberGridTools< T >::ProjectGridOnY(), stira::contrastenhance::HistogramTools::RemapHistogramInROI(), stira::contrastenhance::HistogramTools::RobustLinearRescaleNoNew(), stira::contrastenhance::AdaptiveHistogramEqualizer::Run(), stira::deconvolve::RichardsonLucyDeconvolve::Run(), stira::imageanalysis::Thinning< T >::RunPruning(), stira::imageanalysis::Thinning< T >::RunThinning(), stira::contrastenhance::AdaptiveEnhanceLuong::SetWindowSize(), stira::histogram::IntHistogram::Write(), stira::imagedata::TransformColorSpace::XYZtoAdobeRGB(), and stira::deconvolve::SimulateDegradation::~SimulateDegradation().

double stira::common::MathUtils::ClipValue ( double  value,
double  min = 0.0,
double  max = 255.0 
)
static

Clips value to be in the range [min, max] if the user by accident switches the maximum and minimum values, this method corrects this.

Parameters
minthe minimum value allowed value after clipping
valuethe value to be clipped
maxthe maximum value allowed after clipping
unsigned int stira::common::MathUtils::CombineCharsInInt ( unsigned char  i0,
unsigned char  i1,
unsigned char  i2,
unsigned char  i3 
)
static

combine 4 unsigned in one 32 bit unsigned integer [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 1 ] unsigned char c0 unsigned char c1 unsigned char c2 unsigned char c3

Parameters
c0first input unsigned char, will be placed at the most significant bits of the integer
c1second input unsigned char, will be placed at the next 8 less significant bits of the integer
c2third input unsigned char, will be placed at the next 8 less significant bits of the integer
c3fourth input unsigned char, will be placed at the least significant bits of the integer

Referenced by stira::imagetools::ImageTools::CreateIntArrayFromColorImage().

int stira::common::MathUtils::CompareDoubles ( const void *  a,
const void *  b 
)
static

compare method for two doubles, as needed by qsort

Parameters
afirst number to compare
bsecond number to compare
Returns
-1 if the first number is the smallest, 1 if it is bigger and 0 if both numbers are equal

Referenced by stira::filter::MedianFilter::RunHybridMedian(), and stira::filter::MedianFilter::RunMedian().

int stira::common::MathUtils::CompareFloats ( const void *  a,
const void *  b 
)
static

compare method for two floats, as needed by qsort

Parameters
afirst number to compare
bsecond number to compare
Returns
-1 if the first number is the smallest, 1 if it is bigger and 0 if both numbers are equal
int stira::common::MathUtils::CompareIntegers ( const void *  a,
const void *  b 
)
static

compare method for two doubles, as needed by qsort

Parameters
afirst number to compare
bsecond number to compare
Returns
-1 if the first number is the smallest, 1 if it is bigger and 0 if both numbers are equal

Referenced by stira::filter::MedianFilter::RunMedian().

double stira::common::MathUtils::ComputeArgument ( double  x,
double  y 
)
static
double * stira::common::MathUtils::ComputeCrossCorrelation ( double *  x,
double *  y,
int  nrSamples,
int  maxDelay 
)
static

Computes cross-correlation between two signals x and y Reference: code + explanation: http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/correlate/ general: http://en.wikipedia.org/wiki/Cross-correlation.

Parameters
xarray of values of first function
yarray of values of second function
nrSamplesnumber of elements in x and y
maxDelaymaximum delay to compute cross-correlation for
Returns
array of (2*maxDelay) cross-correlation values
int stira::common::MathUtils::ComputeIntegerPower ( int  myNumber,
int  myExponent 
)
static
double stira::common::MathUtils::ComputePSNR ( double  MSE,
double  peakValue = 255.0 
)
static

Computes PSNR (Peak Signal to Noise Ratio) given the MSE (Mean Square Error) Ref: http://en.wikipedia.org/wiki/PSNR.

Parameters
MSEthe MSE (Mean Square Error)
peakValuemaximum possible value of the data range

Referenced by stira::imagetools::NumberGridTools< T >::ComputePSNR(), stira::imagetools::NumberGridTools< T >::ComputePSNRinROI(), and stira::imagetools::NumberGridTools< T >::CreateSquaredErrorGrid().

double stira::common::MathUtils::Factorial ( const double &  inputNumber)
static

help function to have an exact factorial in case the input number is a casted integer

Parameters
inputNumbernumber of which to compute the factorial

Referenced by stira::fouriertools::TransferFunctionGenerator::GenerateOrientedTransferFunction().

double stira::common::MathUtils::GammaCorrect ( double  inValue,
double  gamma,
double  rangeMin = 0.0,
double  rangeMax = 255.0 
)
static

applies gamma correction to input value Data is for gamma correction first normalized between 0 and 1

Parameters
inValueincoming value
gammavalue of gamma
rangeMinminimum of data range of incoming value
rangeMaxmaximum of data range of incoming value

Referenced by stira::imagetools::ImageTools::ApplyGamma().

double stira::common::MathUtils::Gaussian ( double  x,
double  mu,
double  sigma 
)
static

computes for a value x the value G(x) with G the Gaussian function (as used in probabilities) Reference: http://mathworld.wolfram.com/GaussianFunction.html G(x) = 1/sqrt(2*sigma*pi) * exp( (x - mu) / 2 sigma^2 )

Parameters
xvalue for which to compute the function value
mumu of the function (related to the position of the peak of the function )
sigmasigma of the function (related to the width)

Referenced by stira::filter::GaussConvolve::CreateBlurredBars(), and stira::imagetools::GridGenerator::GenerateGaussian().

double stira::common::MathUtils::Gaussian ( double  x,
double  y,
double  muX,
double  muY,
double  sigmaX,
double  sigmaY 
)
static

computes for a point (x,y) the value G(x,y) with G the 2D Gaussian function (as used in probabilities) Reference: http://mathworld.wolfram.com/GaussianFunction.html G(x) = 1/(2*pi*sigmaX*sigmaY) * exp( (x - muX) / (2 sigmaX^2) + (y - muY) / (2 sigmaY^2) )

Parameters
xx coordinate of point for which to compute the function value
yy coordinate of point for which to compute the function value
muXmuX of the function (related to the x coordinate of the position of the peak of the function )
muYmuY of the function (related to the y coordinate of the position of the peak of the function )
sigmaXsigmaX of the function (related to the width in the x-direction)
sigmaYsigmaY of the function (related to the width in the y-direction)
double stira::common::MathUtils::GaussianD2y ( double  x,
double  y,
double  muX,
double  muY,
double  sigmaX,
double  sigmaY 
)
static

computes for a point (x,y) the value of the second derivative to y of the 2D Gaussian function

Parameters
xx coordinate of point for which to compute the function value
yy coordinate of point for which to compute the function value
muXmuX of the function (related to the x coordinate of the position of the peak of the function )
muYmuY of the function (related to the y coordinate of the position of the peak of the function )
sigmaXsigmaX of the function (related to the width in the x-direction)
sigmaYsigmaY of the function (related to the width in the y-direction)

Referenced by stira::imagetools::GridGenerator::GenerateGaussianSecondDerivativeY().

double stira::common::MathUtils::GaussianDx ( double  x,
double  y,
double  muX,
double  muY,
double  sigmaX,
double  sigmaY 
)
static

computes for a point (x,y) the value of the first derivative to x of the 2D Gaussian function

Parameters
xx coordinate of point for which to compute the function value
yy coordinate of point for which to compute the function value
muXmuX of the function (related to the x coordinate of the position of the peak of the function )
muYmuY of the function (related to the y coordinate of the position of the peak of the function )
sigmaXsigmaX of the function (related to the width in the x-direction)
sigmaYsigmaY of the function (related to the width in the y-direction)

Referenced by stira::imagetools::GridGenerator::GenerateGaussianFirstDerivativeX().

double stira::common::MathUtils::GaussianDxDy ( double  x,
double  y,
double  muX,
double  muY,
double  sigmaX,
double  sigmaY 
)
static

computes for a point (x,y) the value of the mixed first derivatives to x and y of the 2D Gaussian function

Parameters
xx coordinate of point for which to compute the function value
yy coordinate of point for which to compute the function value
muXmuX of the function (related to the x coordinate of the position of the peak of the function )
muYmuY of the function (related to the y coordinate of the position of the peak of the function )
sigmaXsigmaX of the function (related to the width in the x-direction)
sigmaYsigmaY of the function (related to the width in the y-direction)

Referenced by stira::imagetools::GridGenerator::GenerateGaussianMixedDerivativesXY().

double stira::common::MathUtils::GaussianDy ( double  x,
double  y,
double  muX,
double  muY,
double  sigmaX,
double  sigmaY 
)
static

computes for a point (x,y) the value of the first derivative to y of the 2D Gaussian function

Parameters
xx coordinate of point for which to compute the function value
yy coordinate of point for which to compute the function value
muXmuX of the function (related to the x coordinate of the position of the peak of the function )
muYmuY of the function (related to the y coordinate of the position of the peak of the function )
sigmaXsigmaX of the function (related to the width in the x-direction)
sigmaYsigmaY of the function (related to the width in the y-direction)

Referenced by stira::imagetools::GridGenerator::GenerateGaussianFirstDerivativeY().

double stira::common::MathUtils::GaussianFirstDerivativeX1D ( double  x,
double  mu,
double  sigma 
)
static

computes for a value x the value G'(x) with G' the first derivative of the Gaussian function

Parameters
xvalue for which to compute the function value
mumu of the function
sigmasigma of the function

Referenced by stira::filter::GaussConvolve::CreateBlurredBars().

double stira::common::MathUtils::GaussianSecondDerivateX1D ( double  x,
double  mu,
double  sigma 
)
static

computes for a value x the value G''(x) with G'' the second derivative of the Gaussian function

Parameters
xvalue for which to compute the function value
mumu of the function
sigmasigma of the function

Referenced by stira::filter::GaussConvolve::CreateBlurredBars(), and stira::imagetools::GridGenerator::GenerateGaussianSecondDerivativeX().

double stira::common::MathUtils::GaussianSecondDerivateX1D ( double  x,
double  y,
double  muX,
double  muY,
double  sigmaX,
double  sigmaY 
)
static

computes for a point (x,y) the value of the second derivative to x of the 2D Gaussian function

Parameters
xx coordinate of point for which to compute the function value
yy coordinate of point for which to compute the function value
muXmuX of the function (related to the x coordinate of the position of the peak of the function )
muYmuY of the function (related to the y coordinate of the position of the peak of the function )
sigmaXsigmaX of the function (related to the width in the x-direction)
sigmaYsigmaY of the function (related to the width in the y-direction)
std::vector< Point< double > > stira::common::MathUtils::GenerateGaussianPoints ( int  gaussCenterX,
double  sigma,
bool  scaleAmplitude = false,
double  amplitude = 1 
)
static

computes a set of Gaussian sample points The Gaussian has the peak at gaussCenterX, unity sample distance and half width 2 times sigma

Parameters
gaussCenterXx coordinate cooresponding with the center (i.e., the peak)
sigmasigma of the gaussian profile
scaleAmplitudeflag whether or not the values are rescaled so the peak has a predefined value
amplitudepredefined value for the peak
std::vector< Point< double > > stira::common::MathUtils::GenerateGaussianPoints ( std::vector< Point< double > >  inPoints,
int  gaussCenterX,
double  sigma,
bool  scaleAmplitude,
double  amplitude 
)
static

computes a set of Gaussian sample points It uses the x coordinates of inPoints to compute the function value with the peak at gaussCenterX

Parameters
gaussCenterXx coordinate cooresponding with the center (i.e., the peak)
sigmasigma of the gaussian profile
scaleAmplitudeflag whether or not the values are rescaled so the peak has a predefined value
amplitudepredefined value for the peak
std::vector< double > stira::common::MathUtils::GenerateGaussianSamples ( double  sigma)
static

computes a set of points sampled regularly from the Gauss function (NOT random variables with Gaussian distribution!!)

Parameters
sigmasigma of the function
double stira::common::MathUtils::GetMax ( double  value1,
double  value2 
)
static

returns the largest of both input values

Parameters
value1first input value
value2second input value

Referenced by stira::imagetools::ImageTools::ApplyJetColorMap(), and stira::contrastenhance::HazeRemover::Run().

double stira::common::MathUtils::GetMin ( double  value1,
double  value2 
)
static

returns the smallest of both input values

Parameters
value1first input value
value2second input value

Referenced by stira::imagetools::ImageTools::ApplyJetColorMap(), and stira::deconvolve::RichardsonLucyDeconvolve::Run().

double stira::common::MathUtils::GetSteerableInterPolationCoefficient ( int  i,
int  K,
double  theta 
)
static

computes steerable interpolation coefficient for angle theta Suppose B_theta(x,y) = k1(theta) * B1(x,y)) + k2(theta) * B2(x,y)) + k3(theta) * B1(x,y), with B_theta the interpolated band, ki(theta) the interpolation coefficients (i=1,2,3) and Bi(x,y) the basis bands (i=1,2,3). then this function computes ki(theta) This formulation is a generalization of the expression of Freeman and Adelson by Bart Goossens for an arbitrary number of orientations

Parameters
ithe number of the band with which the interpolation coefficient corresponds (see above)
Kthe total number of oriented bands (in our example above, K=3)
thetathe angle under which to interpolate
bool stira::common::MathUtils::IsBetween ( double  testValue,
double  underLimit,
double  upperLimit 
)
static

Checks if a value is between a lower and an upper value.

Parameters
testValuethe value to be checked
underLimitthe lower limit for the value
upperLimitthe upper limit for the value
void stira::common::MathUtils::NormalizeVector ( std::vector< double > &  inVector)
static

normalizes all elements of the vector passed as argument, overwriting the original values

Parameters
inVectorvector to normalize

Referenced by stira::imageanalysis::HOG::ComputeHogDescriptor().

void stira::common::MathUtils::PrintBitsInChar ( unsigned char  c)
static

prints to stdout the bits in an unsigned char

Parameters
cinput unigned char
void stira::common::MathUtils::PrintBitsInInt ( unsigned int  i)
static

prints to stdout the bits in a 32bit unsigned integer

Parameters
iinput unigned integer
bool stira::common::MathUtils::SolveLinearEquation ( double  a,
double  b,
double &  solution 
)
static

solves a linear equation ax + b = 0

Parameters
aslope coefficient
boffset
solutionthe solution of the equation
Returns
false if there is no solution (a==0); true otherwise

Referenced by stira::imageanalysis::StegerLineDetector::Run().

bool stira::common::MathUtils::SolveQuadraticEquation ( double  a,
double  b,
double  c,
double &  outSolution1,
double &  outSolution2 
)

solves a quadratic equation a * x * x + b * x + c = 0 (real-valued case)

Parameters
aquadratic coefficient
blinear coefficient
cconstant
outSolution1the first solution of the equation
outSolution2the second solution of the equation
Returns
true if solutions are real-valued; false otherwise
bool stira::common::MathUtils::SolveQuadraticEquation ( std::complex< double >  a,
std::complex< double >  b,
std::complex< double >  c,
std::complex< double > &  outSolution1,
std::complex< double > &  outSolution2 
)
static

solves a quadratic equation a * x * x + b * x + c = 0 (complex-valued case)

Parameters
aquadratic coefficient
blinear coefficient
cconstant
outSolution1the first solution of the equation
outSolution2the second solution of the equation
Returns
true if solutions are real-valued; false otherwise
std::vector< unsigned char > stira::common::MathUtils::SplitIntInChars ( int  value)
static

splits a 32bit unsigned integer in a vector of 4 unsigned chars

Parameters
valueinput unsigned integer

Referenced by stira::imagetools::ImageTools::CreateColorImageFromIntArray().

void stira::common::MathUtils::SwitchValues ( double &  a,
double &  b 
)
static

switches the values for the variables a and b

Parameters
athe first value; gets the value of b after switch
bthe second value; gets the value of a after switch
void stira::common::MathUtils::SwitchValues ( int &  a,
int &  b 
)
static

switches the values for the variables a and b

Parameters
athe first value; gets the value of b after switch
bthe second value; gets the value of a after switch
double stira::common::MathUtils::ToDegrees ( double  radians)
static

converts radians to degrees

Parameters
radiansvalue in radians to convert to degrees

Referenced by stira::imagedata::OrientationGrid::GetMagnitude(), and stira::imagedata::TransformColorSpace::LabtoLCH().

double stira::common::MathUtils::ToRadians ( double  degrees)
static

converts degrees to radians

Parameters
degreesvalue in degrees to convert to radians

Referenced by stira::imagedata::TransformColorSpace::LCHtoLab(), and stira::imageanalysis::CannyEdgeDetector::~CannyEdgeDetector().


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