Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions | Variables
hugin_utils Namespace Reference

namespace for various utils More...

Classes

struct  TDiff2D
 
struct  ContextSettings
 

Typedefs

typedef TDiff2D< double > FDiff2D
 

Functions

wxString doubleTowxString (double d, int digits)
 
bool str2double (const wxString &s, double &d)
 
template<class str >
str wxQuoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
 
template<class str >
str wxQuoteString (const str &arg)
 Try to escape special chars on windows and linux. More...
 
template<class str >
str wxQuoteFilename (const str &arg)
 Quote a filename, so that it is surrounded by "". More...
 
void sortd (int length, double *a, int *ind)
 
void eig_jacobi (int n, double a[3][3], double v[3][3], double *d, int *ind, int *maxsweep, int *maxannil, double *epsilon)
 Implements jacobi eigenvalue/vector algorithm on a symmetric matrix stored as a 2 dimensional matrix a[n][n] and computes the eigenvectors in another globally allocated matrix v[n][n]. More...
 
int _gcd (int a, int b)
 
int gcd (int a, int b)
 function to calculate greated common divisor using Euclidean algorithm both arguments should be >=0 More...
 
double round (double x)
 
float roundf (float x)
 
int ceili (double x)
 
int floori (double x)
 
template<class T >
int roundi (T x)
 
template<class T >
simpleClipPoint (const T &point, const T &min, const T &max)
 clip a point to fit int [min, max] does not do a mathematical clipping, just sets p.x and p.y to the borders if they are outside. More...
 
template<class T >
sqr (T t)
 
template<class T >
double norm (T t)
 
template<class InputIterator1 , class InputIterator2 >
double euclid_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
 calculate squared Euclidean distance between two vectors. More...
 
template<class InputIterator1 , class InputIterator2 , class T >
sqr_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T res)
 calculate squared Euclidean distance between two vectors. More...
 
template<class POINT >
vigra::Rect2D calcCircleROIFromPoints (const POINT &p1, const POINT &p2)
 calculate the bounding box of a circle that goes through both points. More...
 
template<class str >
str quoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
 utility function; escapes characters in replacements with quotechar. More...
 
template<class str >
str quoteString (const str &arg)
 Try to escape special chars on windows and linux. More...
 
template<class str >
str quoteStringShell (const str &arg)
 Try to escape special chars in a string used by a unix type shell. More...
 
template<class str >
str escapeStringMake (const str &arg)
 Escape dangerous chars in makefile strings/filenames (space),#,=. More...
 
template<class str >
str quoteFilename (const str &arg)
 Quote a filename, so that it is surrounded by "". More...
 
std::string tolower (const std::string &s)
 convert a string to lowercase More...
 
std::string toupper (const std::string &s)
 
std::string GetCurrentTimeString ()
 current time as a string More...
 
std::string getExtension (const std::string &basename)
 Get extension of a filename. More...
 
std::string stripExtension (const std::string &basename)
 remove extension of a filename More...
 
std::string stripPath (const std::string &filename)
 remove the path of a filename (mainly useful for gui display of filenames) More...
 
std::string getPathPrefix (const std::string &filename)
 Get the path to a filename. More...
 
std::string StrTrim (const std::string &str)
 remove trailing and leading white spaces and tabs More...
 
std::string doubleToString (double d, int fractionaldigits=-1)
 convert a double to a string, suitable for display within a GUI. More...
 
bool stringToInt (const std::string &s, int &val)
 convert string to integer value, returns true, if sucessful More...
 
bool stringToUInt (const std::string &s, unsigned int &val)
 convert string to unsigned integer value, returns true, if sucessful More...
 
std::vector< std::string > SplitString (const std::string &s, const std::string &sep)
 split string s at given sep, returns vector of strings More...
 
void ReplaceAll (std::string &s, const std::string &oldChar, char newChar)
 replace all characters oldChar in s with newChar More...
 
bool StringContainsCaseInsensitive (const std::string &s1, const std::string &s2)
 check if s1 contains s2 using case insensitive comparison More...
 
void ControlPointErrorColour (const double cperr, double &r, double &g, double &b)
 
bool FileExists (const std::string &filename)
 checks if file exists More...
 
std::string GetAbsoluteFilename (const std::string &filename)
 returns the full absolute filename More...
 
bool IsFileTypeSupported (const std::string &filename)
 return true, if file type by extension is supported by vigra More...
 
void EnforceExtension (std::string &filename, const std::string &defaultExtension)
 check if filename contains extension, if not add default extension More...
 
std::string GetOutputFilename (const std::string &out, const std::string &in, const std::string &suffix)
 construct output filename, if ouput is known return this value otherwise use the input filename and append the suffix before the extension More...
 
std::string GetDataDir ()
 returns the full path to the data directory More...
 
std::string GetHomeDir ()
 
std::string GetUserAppDataDir ()
 returns the directory for user specific Hugin settings, e.g. More...
 
bool CreateContext (int *argcp, char **argv)
 
void DestroyContext ()
 
bool initGPU (int *argcp, char **argv)
 Try to initalise GLUT and GLEW, and create an OpenGL context for GPU stitching. More...
 
bool wrapupGPU ()
 cleanup GPU settings More...
 
std::string GetHuginVersion ()
 return a string with version numbers More...
 
std::string GetICCDesc (const vigra::ImageImportInfo::ICCProfile &iccProfile)
 returns description of given icc profile More...
 
std::string GetICCDesc (const cmsHPROFILE &profile)
 
std::vector< std::string > GetRawExtensions ()
 return vector of known extensions of raw files, all lower case More...
 
bool IsRawExtension (const std::string testExt)
 return true if extension belongs to a raw file More...
 
template<typename STR >
bool stringToDouble (const STR &str_, double &dest)
 convert a string to a double, ignore localisation. More...
 
template<class str >
str QuoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
 

Variables

static ContextSettings context
 

Detailed Description

namespace for various utils

Typedef Documentation

typedef TDiff2D<double> hugin_utils::FDiff2D

Definition at line 150 of file hugin_math.h.

Function Documentation

int hugin_utils::_gcd ( int  a,
int  b 
)

Definition at line 29 of file hugin_math.cpp.

Referenced by gcd().

template<class POINT >
vigra::Rect2D hugin_utils::calcCircleROIFromPoints ( const POINT &  p1,
const POINT &  p2 
)

calculate the bounding box of a circle that goes through both points.

the center of the circle is halfway between the two points

Definition at line 217 of file hugin_math.h.

References roundi().

int hugin_utils::ceili ( double  x)
inline

Definition at line 60 of file hugin_math.h.

Referenced by HuginBase::estimateImageAlpha().

IMPEX void hugin_utils::ControlPointErrorColour ( const double  cperr,
double &  r,
double &  g,
double &  b 
)
bool hugin_utils::CreateContext ( int *  argcp,
char **  argv 
)
void hugin_utils::DestroyContext ( )
IMPEX std::string hugin_utils::doubleToString ( double  d,
int  fractionaldigits = -1 
)

convert a double to a string, suitable for display within a GUI.

d value to convert t a string fractionaldigits number of fractional digits. -1: not specified, use default.

Definition at line 228 of file utils.cpp.

References celeste::min().

Referenced by doubleTowxString(), PreviewFrame::panoramaChanged(), GLPreviewFrame::panoramaChanged(), HuginBase::SrcPanoImage::readEXIF(), HuginBase::Nona::SetAdvancedOption(), and PanoPanel::UpdateDisplay().

WXIMPEX wxString hugin_utils::doubleTowxString ( double  d,
int  digits 
)
void hugin_utils::eig_jacobi ( int  n,
double  a[3][3],
double  v[3][3],
double *  d,
int *  ind,
int *  maxsweep,
int *  maxannil,
double *  epsilon 
)

Implements jacobi eigenvalue/vector algorithm on a symmetric matrix stored as a 2 dimensional matrix a[n][n] and computes the eigenvectors in another globally allocated matrix v[n][n].

intput: n - size of matrix problem outputs: v - eigenvector matrix d[MAX] - a vector of unsorted eigenvalues ind[MAX] - a vector of indicies sorting d[] into descending order maxanil - number of rotations applied inputs/outputs a - input matrix (the input is changed) maxsweep - on input max number of sweeps

  • on output actual number of sweeps epsilon - on input tolerance to consider offdiagonal elements as zero
  • on output sum of offdiagonal elements

Definition at line 68 of file eig_jacobi.cpp.

References sortd().

Referenced by HuginBase::StraightenPanorama::calcStraighteningRotation().

IMPEX void hugin_utils::EnforceExtension ( std::string &  filename,
const std::string &  defaultExtension 
)

check if filename contains extension, if not add default extension

Definition at line 411 of file utils.cpp.

References getExtension(), and stripExtension().

Referenced by main().

template<class str >
str hugin_utils::escapeStringMake ( const str &  arg)

Escape dangerous chars in makefile strings/filenames (space),#,=.

Definition at line 143 of file platform.h.

References quoteStringInternal().

template<class InputIterator1 , class InputIterator2 >
double hugin_utils::euclid_dist ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2 
)

calculate squared Euclidean distance between two vectors.

Definition at line 183 of file hugin_math.h.

IMPEX bool hugin_utils::FileExists ( const std::string &  filename)
int hugin_utils::floori ( double  x)
inline
int IMPEX hugin_utils::gcd ( int  a,
int  b 
)

function to calculate greated common divisor using Euclidean algorithm both arguments should be >=0

Definition at line 35 of file hugin_math.cpp.

References _gcd().

Referenced by PanoPanel::UpdateDisplay(), and GLPreviewFrame::UpdateRoiDisplay().

IMPEX std::string hugin_utils::GetAbsoluteFilename ( const std::string &  filename)

returns the full absolute filename

replace realpath with function with works without this hack

Definition at line 368 of file utils.cpp.

References FileExists().

Referenced by CreateMissingImages(), main(), PTOCopyMove(), and ReadPanoramaOptionsFromIni().

IMPEX std::string hugin_utils::GetCurrentTimeString ( )

current time as a string

Definition at line 91 of file utils.cpp.

IMPEX std::string hugin_utils::GetDataDir ( )
IMPEX std::string hugin_utils::getExtension ( const std::string &  basename2)
std::string hugin_utils::GetHomeDir ( )

Definition at line 477 of file utils.cpp.

Referenced by GetUserAppDataDir().

IMPEX std::string hugin_utils::GetHuginVersion ( )
IMPEX std::string hugin_utils::GetICCDesc ( const vigra::ImageImportInfo::ICCProfile &  iccProfile)

returns description of given icc profile

Definition at line 925 of file utils.cpp.

Referenced by PrintImageInfo(), PanoCommand::wxAddImagesCmd::processPanorama(), and PanoCommand::wxLoadPTProjectCmd::processPanorama().

IMPEX std::string hugin_utils::GetICCDesc ( const cmsHPROFILE &  profile)

Definition at line 943 of file utils.cpp.

References StrTrim().

IMPEX std::string hugin_utils::GetOutputFilename ( const std::string &  out,
const std::string &  in,
const std::string &  suffix 
)

construct output filename, if ouput is known return this value otherwise use the input filename and append the suffix before the extension

Definition at line 420 of file utils.cpp.

References getExtension().

Referenced by main().

IMPEX std::string hugin_utils::getPathPrefix ( const std::string &  filename)
IMPEX std::vector< std::string > hugin_utils::GetRawExtensions ( )

return vector of known extensions of raw files, all lower case

return vector of known extensions of raw files, all in lower case

Definition at line 953 of file utils.cpp.

Referenced by GetFileDialogImageAndRawFilters(), IsRawExtension(), and IsRawExtension().

IMPEX std::string hugin_utils::GetUserAppDataDir ( )
IMPEX bool hugin_utils::initGPU ( int *  argcp,
char **  argv 
)

Try to initalise GLUT and GLEW, and create an OpenGL context for GPU stitching.

OpenGL extensions required by the GPU stitcher (-g option) are checked here.

Returns
true if everything went OK, false if we can't use GPU mode.

Definition at line 858 of file utils.cpp.

References CreateContext(), DestroyContext(), and stripPath().

Referenced by main().

IMPEX bool hugin_utils::IsFileTypeSupported ( const std::string &  filename)

return true, if file type by extension is supported by vigra

Definition at line 405 of file utils.cpp.

References getExtension().

Referenced by main().

IMPEX bool hugin_utils::IsRawExtension ( const std::string  testExt)

return true if extension belongs to a raw file

Definition at line 959 of file utils.cpp.

References GetRawExtensions(), and tolower().

Referenced by main().

template<class T >
double hugin_utils::norm ( t)
template<class str >
str hugin_utils::quoteFilename ( const str &  arg)

Quote a filename, so that it is surrounded by "".

I don't know the escape char for windows

Definition at line 158 of file platform.h.

References quoteStringInternal().

Referenced by AutoPanoSift::automatch(), and AutoPanoKolor::automatch().

template<class str >
str hugin_utils::quoteString ( const str &  arg)

Try to escape special chars on windows and linux.

: I'm quite sure that this routine doesn't replace some important shell chars I don't know of. This could lead to nasty behaviour and maybe even security holes.

Definition at line 106 of file platform.h.

References quoteStringInternal().

template<class str >
str hugin_utils::quoteStringInternal ( const str &  arg,
const str &  quotechar,
const str &  replacements 
)

utility function; escapes characters in replacements with quotechar.

Definition at line 54 of file platform.h.

Referenced by escapeStringMake(), quoteFilename(), quoteString(), and quoteStringShell().

template<class str >
str hugin_utils::QuoteStringInternal ( const str &  arg,
const str &  quotechar,
const str &  replacements 
)

Definition at line 183 of file utils.h.

template<class str >
str hugin_utils::quoteStringShell ( const str &  arg)

Try to escape special chars in a string used by a unix type shell.

: I'm quite sure that this routine doesn't replace some important shell chars I don't know of. This could lead to nasty behaviour and maybe even security holes.

Note that : and = are not special shell charaters but they also should be escaped because they causes problems with gnumake.

Definition at line 128 of file platform.h.

References quoteStringInternal().

IMPEX void hugin_utils::ReplaceAll ( std::string &  s,
const std::string &  oldChar,
char  newChar 
)

replace all characters oldChar in s with newChar

Definition at line 325 of file utils.cpp.

double hugin_utils::round ( double  x)
inline
float hugin_utils::roundf ( float  x)
inline

Definition at line 55 of file hugin_math.h.

template<class T >
int hugin_utils::roundi ( x)
inline

Definition at line 73 of file hugin_math.h.

Referenced by HuginLines::_getVerticalLines(), vigra_ext::ApplyGammaFunctor< vigra::UInt16, vigra::UInt8 >::ApplyGammaFunctor(), lfeat::CircularKeyPointDescriptor::assignOrientation(), AutoPanoSiftMultiRow::automatch(), lfeat::BoxFilter::BoxFilter(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::calcAlpha(), calcCircleROIFromPoints(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::calcSrcCoordImgs(), lfeat::KeyPointDetector::calcTrace(), HuginBase::Photometric::ResponseTransform< VTIn >::calcVigFactor(), HuginBase::Panorama::centerCropImage(), correctImage(), CPEvent::CPEvent(), createCtrlPoints(), lfeat::CircularKeyPointDescriptor::createDescriptor(), MaskEditorPanel::DisplayCrop(), PanoPanel::DoCalcFOV(), PanoPanel::DoCalcOptimalWidth(), DisplayedControlPoint::Draw(), DisplayedControlPoint::DrawLine(), DisplayedControlPoint::DrawLineSegment(), PreviewPanel::DrawOutline(), LensCalImageCtrl::DrawView(), HuginBase::estimateImageAlpha(), MyExecPanel::ExecNextQueue(), CPEditorPanel::FineTuneSelectedPoint(), HuginQueue::GetAssistantCommandQueue(), HuginBase::LensDB::LensDB::GetCrop(), CPImageCtrl::GetMagBitmap(), HuginBase::CalculateOptimalScale::getResultOptimalWidth(), GreatCircleArc::GreatCircleArc(), loadPoints(), loadPointsC(), main(), PanoDetector::matchMultiRow(), GLViewer::MouseEnter(), GLViewer::MouseMotion(), CPEditorPanel::OnCPEvent(), GLPreviewFrame::OnCreateCP(), CPImageCtrl::OnDraw(), MainFrame::OnFineTuneAll(), PreviewFrame::OnFitPano(), GLPreviewFrame::OnFitPano(), LensCalImageCtrl::OnMouseEvent(), PanoOutputDialog::OnOk(), RawImportProgress::OnProcessReferenceTerminate(), MyExecPanel::OnProcessTerminated(), RawImportProgress::OnProgress(), PanoOutputDialog::PanoOutputDialog(), PreviewFrame::panoramaChanged(), GLPreviewFrame::panoramaChanged(), PointFineTuneProjectionAware(), print_result(), PanoCommand::CenterPanoCmd::processPanorama(), PanoCommand::StraightenPanoCmd::processPanorama(), ReadPanoramaOptionsFromIni(), HuginQueue::detail::ReplaceWidthHeightPlaceHolder(), LensCalImageCtrl::Resize(), CPImageCtrl::roundP(), HuginBase::FitPanorama::runAlgorithm(), HuginBase::PointSampler::sampleAndExtractPoints(), SetCanvas(), SetFOV(), HuginBase::PanoramaOptions::setVFOV(), HuginBase::PanoramaOptions::setWidth(), CPImageCtrl::showPosition(), hugin_utils::TDiff2D< T >::toDiff2D(), HuginBase::Nona::traceImageOutline(), MaskImageCtrl::UpdateCrop(), and PreferencesDialog::UpdateDisplayData().

template<class T >
T hugin_utils::simpleClipPoint ( const T &  point,
const T &  min,
const T &  max 
)

clip a point to fit int [min, max] does not do a mathematical clipping, just sets p.x and p.y to the borders if they are outside.

Definition at line 158 of file hugin_math.h.

Referenced by vigra_ext::PointFineTune(), and VisualizationState::SetViewingCenter().

void hugin_utils::sortd ( int  length,
double *  a,
int *  ind 
)

Definition at line 24 of file eig_jacobi.cpp.

Referenced by eig_jacobi().

IMPEX std::vector< std::string > hugin_utils::SplitString ( const std::string &  s,
const std::string &  sep 
)
template<class T >
T hugin_utils::sqr ( t)
template<class InputIterator1 , class InputIterator2 , class T >
T hugin_utils::sqr_dist ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
res 
)

calculate squared Euclidean distance between two vectors.

Definition at line 200 of file hugin_math.h.

WXIMPEX bool hugin_utils::str2double ( const wxString &  s,
double &  d 
)
IMPEX bool hugin_utils::StringContainsCaseInsensitive ( const std::string &  s1,
const std::string &  s2 
)

check if s1 contains s2 using case insensitive comparison

Definition at line 335 of file utils.cpp.

References tolower().

Referenced by HuginBase::SrcPanoImage::readEXIF().

template<typename STR >
bool hugin_utils::stringToDouble ( const STR &  str_,
double &  dest 
)
IMPEX bool hugin_utils::stringToInt ( const std::string &  s,
int &  val 
)
IMPEX bool hugin_utils::stringToUInt ( const std::string &  s,
unsigned int &  val 
)

convert string to unsigned integer value, returns true, if sucessful

Definition at line 280 of file utils.cpp.

References stringToInt().

Referenced by main(), and SetCrop().

IMPEX std::string hugin_utils::stripExtension ( const std::string &  basename2)
IMPEX std::string hugin_utils::stripPath ( const std::string &  filename)
IMPEX std::string hugin_utils::StrTrim ( const std::string &  str)
std::string hugin_utils::tolower ( const std::string &  s)
inline
std::string hugin_utils::toupper ( const std::string &  s)
inline
IMPEX bool hugin_utils::wrapupGPU ( )

cleanup GPU settings

Definition at line 914 of file utils.cpp.

References DestroyContext().

Referenced by main().

template<class str >
str hugin_utils::wxQuoteFilename ( const str &  arg)

Quote a filename, so that it is surrounded by "".

I don't know the escape char for windows

Definition at line 82 of file wxPlatform.h.

References wxQuoteStringInternal().

Referenced by AutoPanoSift::automatch(), AutoPanoKolor::automatch(), AutoCtrlPointCreator::Cleanup(), PanoPanel::DoSendToBatch(), PanoPanel::DoStitch(), MyExecuteCommandOnDialog(), and MainFrame::OnSendToAssistantQueue().

template<class str >
str hugin_utils::wxQuoteString ( const str &  arg)

Try to escape special chars on windows and linux.

: I'm quite sure that this routine doesn't replace some important shell chars I don't know of. This could lead to nasty behaviour and maybe even security holes.

Definition at line 66 of file wxPlatform.h.

References wxQuoteStringInternal().

Referenced by PanoPanel::DoSendToBatch().

template<class str >
str hugin_utils::wxQuoteStringInternal ( const str &  arg,
const str &  quotechar,
const str &  replacements 
)

Definition at line 36 of file wxPlatform.h.

Referenced by HuginQueue::wxEscapeFilename(), wxQuoteFilename(), and wxQuoteString().

Variable Documentation

ContextSettings hugin_utils::context
static

Definition at line 787 of file utils.cpp.

Referenced by CreateContext(), and DestroyContext().