hugin_utils Namespace Reference

namespace for various utils More...


Classes

struct  GraphEdge
struct  RemoveVisitor
 removes vertices from the set More...
struct  TrackVisitor
 remember/track all visited vertices More...
struct  TDiff2D
class  LMS_Solver
 Solve a linear least squares problem. More...

Namespaces

namespace  TRANSFORM

Typedefs

typedef std::vector< int > AdjList
typedef std::vector< AdjListAdjListGraph
typedef TDiff2D< double > FDiff2D

Functions

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.
template<class str>
str wxQuoteFilename (const str &arg)
 Quote a filename, so that it is surrounded by "".
wxString doubleTowxString (double d, int digits=-1)
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].
void findSubGraphs (AdjListGraph &graph, std::vector< int > &subgraphStart)
 find subgraphs
template<class FUNCTOR>
void traverseEdges (const AdjListGraph &graph, int startNode, FUNCTOR &visitor)
 traverse a graph, and run visitor on every vertice - vertice edge encounterd
template<class FUNCTOR>
void traverseVertices (const AdjListGraph &graph, int start, FUNCTOR &visitor)
 traverse graph vertices
double round (double x)
float roundf (float x)
int ceili (double x)
int floori (double x)
template<class T>
int roundi (T x)
int isnan (double 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.
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.
template<class InputIterator1, class InputIterator2, class T>
sqr_dist (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T res)
 calculate squared Euclidean distance between two vectors.
template<class POINT>
vigra::Rect2D calcCircleROIFromPoints (const POINT &p1, const POINT &p2)
 calculate the bounding box of a circle that goes through both points.
int getCPUCount ()
 return the CPU count. On error returns a cpu count of 0 or -1
template<class str>
str quoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
 utility function; escapes characters in replacements with quotechar.
template<class str>
str quoteString (const str &arg)
 Try to escape special chars on windows and linux.
template<class str>
str quoteStringShell (const str &arg)
 Try to escape special chars in a string used by a unix type shell.
template<class str>
str escapeStringMake (const str &arg)
 Escape dangerous chars in makefile strings/filenames (space),#,=.
template<class str>
str quoteFilename (const str &arg)
 Quote a filename, so that it is surrounded by "".
std::string tolower (const std::string &s)
 convert a string to lowercase
std::string GetCurrentTimeString ()
 current time as a string
std::string getExtension (const std::string &basename)
 Get extension of a filename.
std::string stripExtension (const std::string &basename)
 remove extension of a filename
std::string stripPath (const std::string &filename)
 remove the path of a filename (mainly useful for gui display of filenames)
std::string getPathPrefix (const std::string &filename)
 Get the path to a filename.
std::string doubleToString (double d, int fractionaldigits=-1)
 convert a double to a string, suitable for display within a GUI.
void ControlPointErrorColour (const double cperr, double &r, double &g, double &b)
bool FileExists (const std::string filename)
 checks if file exists
std::string GetAbsoluteFilename (const std::string filename)
 returns the full absolute filename
template<typename STR>
bool stringToDouble (const STR &str_, double &dest)
 convert a string to a double, ignore localisation.
template<typename Target, typename Source>
Target lexical_cast (Source arg)
template<class str>
str QuoteStringInternal (const str &arg, const str &quotechar, const str &replacements)
template<class str>
str replaceAll (const str &arg, const str &target, const str &replacement)


Detailed Description

namespace for various utils

Typedef Documentation

typedef std::vector<int> hugin_utils::AdjList

Definition at line 42 of file graph.h.

typedef std::vector<AdjList> hugin_utils::AdjListGraph

Definition at line 43 of file graph.h.

typedef TDiff2D<double> hugin_utils::FDiff2D

Definition at line 183 of file hugin_math.h.


Function Documentation

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

Definition at line 37 of file wxPlatform.h.

Referenced by wxQuoteFilename(), and wxQuoteString().

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 67 of file wxPlatform.h.

References wxQuoteStringInternal().

Referenced by PanoPanel::DoSendToBatch(), getGNUMakeCmd(), and RunStitchPanel::StitchProject().

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 83 of file wxPlatform.h.

References wxQuoteStringInternal().

Referenced by AutoPanoSift::automatch(), RunStitchPanel::DetectProject(), PanoPanel::DoSendToBatch(), PanoPanel::DoStitch(), MyExecuteCommandOnDialog(), MainFrame::OnSendToAssistantQueue(), MainFrame::RunAssistant(), and RunStitchPanel::StitchProject().

wxString hugin_utils::doubleTowxString ( double  d,
int  digits = -1 
) [inline]

Definition at line 97 of file wxPlatform.h.

References doubleToString().

Referenced by LensCalFrame::AddImages(), EVT_BUTTON(), ImageVariableDialog::InitValues(), ImagesTreeCtrl::OnBeginEdit(), HFOVDialog::OnCropFactorChanged(), HFOVDialog::OnFocalLengthChanged(), HFOVDialog::OnHFOVChanged(), HFOVDialog::OnLoadLensParameters(), CPListFrame::OnSelectButton(), ImagesPanel::OnSelectionChanged(), HFOVDialog::OnTypeChanged(), LensCalFrame::Optimize(), ImagesPanel::panoramaChanged(), GLPreviewFrame::panoramaChanged(), LensCalFrame::ParametersToDisplay(), SaveLensDBDialog::SetAperture(), LoadLensDBDialog::SetAperture(), SaveLensDBDialog::SetFocalLength(), LoadLensDBDialog::SetFocalLength(), SaveLensDBDialog::SetSubjectDistance(), LoadLensDBDialog::SetSubjectDistance(), PreferencesDialog::UpdateDisplayData(), ImagesTreeCtrl::UpdateGroupText(), and ImagesTreeCtrl::UpdateImageText().

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

Definition at line 24 of file eig_jacobi.cpp.

Referenced by eig_jacobi().

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

Definition at line 68 of file eig_jacobi.cpp.

References sortd().

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

void hugin_utils::findSubGraphs ( AdjListGraph graph,
std::vector< int > &  subgraphStart 
)

find subgraphs

Actually, we could just use the BOOST graph library instead of hacking our own graph functions.

Definition at line 39 of file graph.cpp.

References traverseVertices().

template<class FUNCTOR>
void hugin_utils::traverseEdges ( const AdjListGraph graph,
int  startNode,
FUNCTOR &  visitor 
)

traverse a graph, and run visitor on every vertice - vertice edge encounterd

Definition at line 81 of file graph.h.

References DEBUG_DEBUG, and set_contains().

template<class FUNCTOR>
void hugin_utils::traverseVertices ( const AdjListGraph graph,
int  start,
FUNCTOR &  visitor 
)

traverse graph vertices

Definition at line 121 of file graph.h.

References set_contains().

Referenced by findSubGraphs().

double hugin_utils::round ( double  x  )  [inline]

Definition at line 72 of file hugin_math.h.

Referenced by PreviewPanel::updatePreview().

float hugin_utils::roundf ( float  x  )  [inline]

Definition at line 79 of file hugin_math.h.

int hugin_utils::ceili ( double  x  )  [inline]

Definition at line 84 of file hugin_math.h.

Referenced by HuginBase::estimateImageAlpha().

int hugin_utils::floori ( double  x  )  [inline]

Definition at line 89 of file hugin_math.h.

Referenced by HuginBase::CalculateCPStatisticsRadial::calcCtrlPntsRadiStats(), HuginBase::estimateImageAlpha(), and PanoOutputDialog::PanoOutputDialog().

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

Definition at line 97 of file hugin_math.h.

Referenced by HuginLines::_getVerticalLines(), vigra_ext::ApplyGammaFunctor< vigra::UInt16, vigra::UInt8 >::ApplyGammaFunctor(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::calcAlpha(), calcCircleROIFromPoints(), PT::Panorama::calcOptimalWidth(), HuginBase::Photometric::ResponseTransform< VTIn >::calcVigFactor(), correctImage(), CPEvent::CPEvent(), createCtrlPoints(), createCtrlPointsOld(), HuginBase::AssistantMakefilelibExport::createItems(), RunStitchPanel::DetectProject(), MaskEditorPanel::DisplayCrop(), PanoPanel::DoCalcFOV(), DisplayedControlPoint::Draw(), DisplayedControlPoint::DrawLine(), DisplayedControlPoint::DrawLineSegment(), PreviewPanel::DrawOutline(), LensCalImageCtrl::DrawView(), HuginBase::estimateImageAlpha(), CPEditorPanel::FineTuneSelectedPoint(), CPImageCtrl::generateMagBitmap(), HuginBase::CalculateOptimalScale::getResultOptimalWidth(), loadPoints(), loadPointsC(), main(), CPImageCtrl::mouseMoveEvent(), CPEditorPanel::OnCPEvent(), CPImageCtrl::OnDraw(), MainFrame::OnFineTuneAll(), PreviewFrame::OnFitPano(), GLPreviewFrame::OnFitPano(), LensCalImageCtrl::OnMouseEvent(), PanoOutputDialog::OnOk(), PreviewFrame::panoramaChanged(), GLPreviewFrame::panoramaChanged(), print_result(), PT::StraightenPanoCmd::processPanorama(), PT::CenterPanoCmd::processPanorama(), LensCalImageCtrl::Resize(), CPImageCtrl::roundP(), HuginBase::FitPanorama::runAlgorithm(), MainFrame::RunAssistant(), HuginBase::PointSampler::sampleAndExtractPoints(), HuginBase::PanoramaOptions::setVFOV(), HuginBase::PanoramaOptions::setWidth(), CPImageCtrl::showPosition(), hugin_utils::TDiff2D< double >::toDiff2D(), HuginBase::Nona::traceImageOutline(), MaskImageCtrl::UpdateCrop(), PreferencesDialog::UpdateDisplayData(), and AppBase::StreamProgressDisplay::updateProgressDisplay().

int hugin_utils::isnan ( double  x  )  [inline]

Definition at line 104 of file hugin_math.h.

Referenced by vigra_ext::subpixelMaxima().

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 191 of file hugin_math.h.

Referenced by vigra_ext::PointFineTune(), and PointFineTune2().

template<class T>
T hugin_utils::sqr ( t  ) 

Definition at line 202 of file hugin_math.h.

Referenced by HuginLines::_getVerticalLines(), HuginLines::GetFootpoint(), vigra_ext::optimizeVignettingQuotient(), HuginBase::AllPointSampler::sampleAllPanoPoints(), and HuginBase::RandomPointSampler::sampleRandomPanoPoints().

template<class T>
double hugin_utils::norm ( t  ) 

Definition at line 208 of file hugin_math.h.

Referenced by HuginBase::CalculateOptimalScale::calcOptimalPanoScale(), HuginBase::MaskPolygon::FindPointNearPos(), HuginLines::GetFootpoint(), HuginBase::AllPointSampler::sampleAllPanoPoints(), HuginBase::RandomPointSampler::sampleRandomPanoPoints(), and HuginBase::MaskPolygon::subSample().

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 216 of file hugin_math.h.

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 233 of file hugin_math.h.

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 250 of file hugin_math.h.

References roundi().

IMPEX int hugin_utils::getCPUCount (  ) 

return the CPU count. On error returns a cpu count of 0 or -1

Definition at line 50 of file platform.cpp.

Referenced by main().

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 65 of file platform.h.

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

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 117 of file platform.h.

References quoteStringInternal().

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 139 of file platform.h.

References quoteStringInternal().

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

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

Definition at line 154 of file platform.h.

References quoteStringInternal().

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 169 of file platform.h.

References quoteStringInternal().

std::string hugin_utils::tolower ( const std::string s  )  [inline]

convert a string to lowercase

Definition at line 49 of file stl_utils.h.

Referenced by BuildMountName(), HuginBase::LensDB::LensDB::FindLens(), HuginBase::LensDB::LensDB::FindLenses(), main(), parseOptions(), HuginBase::Nona::SimpleStitcher< ImageType, AlphaType >::stitch(), HuginBase::Nona::ReduceStitcher< ImageType, AlphaType >::stitch(), and HuginBase::Nona::WeightedStitcher< ImageType, AlphaType >::stitch().

IMPEX std::string hugin_utils::GetCurrentTimeString (  ) 

current time as a string

Definition at line 53 of file utils.cpp.

IMPEX std::string hugin_utils::getExtension ( const std::string basename2  ) 

Get extension of a filename.

Definition at line 61 of file utils.cpp.

Referenced by main(), HuginBase::Nona::SimpleStitcher< ImageType, AlphaType >::stitch(), HuginBase::Nona::ReduceStitcher< ImageType, AlphaType >::stitch(), and HuginBase::Nona::WeightedStitcher< ImageType, AlphaType >::stitch().

IMPEX std::string hugin_utils::stripExtension ( const std::string basename2  ) 

remove extension of a filename

Definition at line 92 of file utils.cpp.

Referenced by convert_file(), getKeyfilenameFor(), main(), MainFrame::OnSaveProject(), reduceFilesToHDR(), HuginBase::Nona::SimpleStitcher< ImageType, AlphaType >::stitch(), HuginBase::Nona::ReduceStitcher< ImageType, AlphaType >::stitch(), and HuginBase::Nona::WeightedStitcher< ImageType, AlphaType >::stitch().

IMPEX std::string hugin_utils::stripPath ( const std::string filename  ) 

remove the path of a filename (mainly useful for gui display of filenames)

Definition at line 122 of file utils.cpp.

References celeste::max().

Referenced by HuginBase::ImageCache::getImage(), getKeyfilenameFor(), HuginBase::Nona::FileRemapper< ImageType, AlphaType >::getRemapped(), HuginBase::ImageCache::getSmallImage(), main(), MainFrame::OnSaveProject(), PT::wxLoadPTProjectCmd::processPanorama(), AutoCtrlPointCreator::readUpdatedControlPoints(), HuginBase::Nona::remapImage(), HuginBase::Nona::MultiImageRemapper< vigra::FRGBImage, AlphaImageType >::saveRemapped(), HuginBase::Nona::SimpleStitcher< ImageType, AlphaType >::stitch(), and HuginBase::Nona::WeightedStitcher< ImageType, AlphaType >::stitch().

IMPEX std::string hugin_utils::getPathPrefix ( const std::string filename  ) 

Get the path to a filename.

Definition at line 146 of file utils.cpp.

References celeste::max().

Referenced by PanoDetector::loadProject(), main(), MainFrame::OnSaveProject(), LensCalFrame::OnSaveProject(), and processPTO().

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 170 of file utils.cpp.

Referenced by doubleTowxString(), HuginBase::LensDB::LensDBList::GetLensName(), PreviewFrame::panoramaChanged(), and GLPreviewFrame::panoramaChanged().

IMPEX void hugin_utils::ControlPointErrorColour ( const double  cperr,
double &  r,
double &  g,
double &  b 
)

Definition at line 205 of file utils.cpp.

Referenced by PreviewControlPointTool::AfterDrawImagesEvent(), PreviewLayoutLinesTool::LineDetails::draw(), and CPImagesComboBox::OnDrawItem().

IMPEX bool hugin_utils::FileExists ( const std::string  filename  ) 

checks if file exists

Definition at line 226 of file utils.cpp.

Referenced by PanoPanel::DoSendToBatch(), GetAbsoluteFilename(), getProgram(), PanoDetector::loadProject(), main(), FailedProjectsDialog::OnSelectProject(), MainFrame::OnSendToAssistantQueue(), PT::wxAddImagesCmd::processPanorama(), MaskImageCtrl::setImage(), and CPImageCtrl::setImage().

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 232 of file utils.cpp.

References FileExists().

Referenced by main().

template<typename STR>
bool hugin_utils::stringToDouble ( const STR &  str_,
double &  dest 
)

convert a string to a double, ignore localisation.

always accept both.

sets dest to the new value, and returns true if it could be read.

it the conversion fails, returns false and does not modify dest.

Returns:
success

Definition at line 177 of file utils.h.

References DEBUG_DEBUG.

Referenced by HuginBase::PTScriptParsing::getDoubleParam(), HuginBase::PTScriptParsing::getPTDoubleParam(), GLPreviewFrame::OnNumTransform(), HuginBase::PTScriptParsing::readVar(), str2double(), and PreferencesDialog::UpdateConfigData().

template<typename Target, typename Source>
Target hugin_utils::lexical_cast ( Source  arg  ) 

Definition at line 228 of file utils.h.

References DEBUG_ERROR.

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

Definition at line 249 of file utils.h.

template<class str>
str hugin_utils::replaceAll ( const str &  arg,
const str &  target,
const str &  replacement 
)

Definition at line 273 of file utils.h.


Generated on 24 Oct 2014 for Hugintrunk by  doxygen 1.4.7