tca_correct.cpp File Reference

program to align a set of well overlapping images (~90%) More...

#include <hugin_config.h>
#include <fstream>
#include <sstream>
#include <iostream>
#include <vigra/error.hxx>
#include <vigra_ext/impexalpha.hxx>
#include <vigra/cornerdetection.hxx>
#include <vigra/localminmax.hxx>
#include <hugin_utils/utils.h>
#include <hugin_math/hugin_math.h>
#include "vigra/stdimage.hxx"
#include "vigra/stdimagefunctions.hxx"
#include "vigra/functorexpression.hxx"
#include "vigra/transformimage.hxx"
#include <vigra_ext/Pyramid.h>
#include <vigra_ext/Correlation.h>
#include <vigra_ext/InterestPoints.h>
#include <vigra_ext/utils.h>
#include <panodata/Panorama.h>
#include <panodata/StandardImageVariableGroups.h>
#include <panotools/PanoToolsOptimizerWrapper.h>
#include <algorithms/optimizer/PTOptimizer.h>
#include <nona/Stitcher.h>
#include <foreign/levmar/levmar.h>
#include <hugin_utils/openmp_lock.h>
#include <lensdb/LensDB.h>
#include <getopt.h>
#include <unistd.h>
#include <tiff.h>

Include dependency graph for tca_correct.cpp:

Go to the source code of this file.


struct  Parameters
struct  OptimData




typedef std::multimap< double,
vigra::Diff2D > 


void get_optvars (HuginBase::OptimizeVector &_retval)
static int ptProgress (int command, char *argument)
static int ptinfoDlg (int command, char *argument)
int optimize_old (HuginBase::Panorama &pano)
double weightHuber (double x, double sigma)
void optGetError (double *p, double *x, int m, int n, void *data)
int optVis (double *p, double *x, int m, int n, int iter, double sqerror, void *data)
void optimize_new (HuginBase::PanoramaData &pano)
static void usage (const char *name)
template<class ImageType>
void createCtrlPoints (HuginBase::Panorama &pano, const ImageType &img, int imgRedNr, int imgGreenNr, int imgBlueNr, double scale, int nPoints, unsigned grid)
int main2 (HuginBase::Panorama &pano)
template<class PixelType>
int processImg (const char *filename)
int processPTO (const char *filename)
void resetValues (HuginBase::Panorama &pano)
void print_result (HuginBase::Panorama &pano)
int main (int argc, char *argv[])


Parameters g_param
static hugin_omp::Lock lock

Detailed Description

program to align a set of well overlapping images (~90%)

Pablo d'Angelo <>
align_image_stack.cpp 2493 2007-10-24 20:26:26Z dangelo

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this software. If not, see <>.

Definition in file tca_correct.cpp.

Define Documentation


Definition at line 65 of file tca_correct.cpp.

Referenced by main().

Typedef Documentation

typedef std::multimap<double, vigra::Diff2D> MapPoints

Definition at line 440 of file tca_correct.cpp.

Function Documentation

template<class ImageType>
void createCtrlPoints ( HuginBase::Panorama pano,
const ImageType img,
int  imgRedNr,
int  imgGreenNr,
int  imgBlueNr,
double  scale,
int  nPoints,
unsigned  grid 

Definition at line 443 of file tca_correct.cpp.

References HuginBase::Panorama::addCtrlPoint(), cout, vigra_ext::destImage(), HuginBase::ControlPoint::error, vigra_ext::findInterestPointsPartial(), g_param, lock, celeste::max(), vigra_ext::CorrelationResult::maxi, vigra_ext::CorrelationResult::maxpos, vigra_ext::PointFineTune(), hugin_utils::roundi(), vigra_ext::srcImageRange(), vigra_ext::transformImage(), Parameters::verbose, hugin_utils::TDiff2D< T >::x, HuginBase::ControlPoint::x1, HuginBase::ControlPoint::x2, hugin_utils::TDiff2D< T >::y, HuginBase::ControlPoint::y1, and HuginBase::ControlPoint::y2.

void get_optvars ( HuginBase::OptimizeVector _retval  ) 

Definition at line 209 of file tca_correct.cpp.

References g_param, and Parameters::optvars.

Referenced by optimize_new(), and optimize_old().

int main ( int  argc,
char *  argv[] 

Definition at line 911 of file tca_correct.cpp.

References Parameters::basename, Parameters::blue_name, cerr, Parameters::cpErrorThreshold, DEFAULT_OPTIMISATION_PARAMETER, g_param, Parameters::green_name, Parameters::grid, Parameters::load, Parameters::nPoints, Parameters::optMethod, Parameters::optvars, processPTO(), Parameters::ptoOutputFile, Parameters::red_name, Parameters::reset, Parameters::saveDB, Parameters::scale, hugin_utils::stripPath(), usage(), and Parameters::verbose.

int main2 ( HuginBase::Panorama pano  ) 

Definition at line 850 of file tca_correct.cpp.

References g_param, optimize_new(), optimize_old(), Parameters::optMethod, Parameters::reset, and resetValues().

void optGetError ( double *  p,
double *  x,
int  m,
int  n,
void *  data 

Definition at line 260 of file tca_correct.cpp.

References HuginBase::ControlPoint::error, OptimData::FromX(), HuginBase::PanoramaData::getCtrlPoint(), HuginBase::PanoramaData::getNrOfCtrlPoints(), OptimData::huberSigma, OptimData::m_center, OptimData::m_dist, OptimData::m_hfov, OptimData::m_pano, OptimData::m_shift, celeste::min(), vigra_ext::pow(), HuginBase::PanoramaData::updateCtrlPointErrors(), and HuginBase::weightHuber().

Referenced by optimize_new().

void optimize_new ( HuginBase::PanoramaData pano  ) 

Definition at line 344 of file tca_correct.cpp.

References g_param, get_optvars(), HuginBase::PanoramaData::getNrOfCtrlPoints(), OptimData::huberSigma, celeste::info(), OptimData::m_mapping, optGetError(), optVis(), OptimData::SaveToImgs(), OptimData::ToX(), and Parameters::verbose.

Referenced by main2().

int optimize_old ( HuginBase::Panorama pano  ) 

Definition at line 235 of file tca_correct.cpp.

References g_param, get_optvars(), HuginBase::PTools::optimize(), ptinfoDlg(), ptProgress(), HuginBase::Panorama::setOptimizeVector(), and Parameters::verbose.

Referenced by main2().

int optVis ( double *  p,
double *  x,
int  m,
int  n,
int  iter,
double  sqerror,
void *  data 

Definition at line 330 of file tca_correct.cpp.

Referenced by optimize_new().

void print_result ( HuginBase::Panorama pano  ) 

Definition at line 733 of file tca_correct.cpp.

References Parameters::basename, HuginBase::LensDB::LensDB::Clean(), cout, g_param, HuginBase::SrcPanoImage::getDBLensName(), HuginBase::LensDB::LensDB::GetSingleton(), HuginBase::Panorama::getSrcImage(), vigra_ext::pow(), HuginBase::SrcPanoImage::readEXIF(), hugin_utils::roundi(), Parameters::saveDB, HuginBase::LensDB::LensDB::SaveTCA(), HuginBase::BaseSrcPanoImage::setFilename(), shift, and hugin_utils::StrTrim().

template<class PixelType>
int processImg ( const char *  filename  ) 

Definition at line 568 of file tca_correct.cpp.

References HuginBase::Panorama::addImage(), Parameters::blue_name, cerr, createCtrlPoints(), vigra_ext::destImage(), g_param, HuginBase::StandardImageVariableGroups::getLenses(), Parameters::green_name, Parameters::grid, HuginBase::PanoramaOptions::huberSigma, vigra::importImageAlpha(), HuginBase::ConstImageVariableGroup::IVE_HFOV, HuginBase::ConstImageVariableGroup::IVE_RadialDistortion, main2(), Parameters::nPoints, HuginBase::PanoramaOptions::outputFormat, HuginBase::PanoramaOptions::RECTILINEAR, HuginBase::BaseSrcPanoImage::RECTILINEAR, Parameters::red_name, Parameters::scale, HuginBase::BaseSrcPanoImage::setCropFactor(), HuginBase::BaseSrcPanoImage::setFilename(), HuginBase::PanoramaOptions::setHeight(), HuginBase::PanoramaOptions::setHFOV(), HuginBase::BaseSrcPanoImage::setHFOV(), HuginBase::Panorama::setOptions(), HuginBase::PanoramaOptions::setProjection(), HuginBase::BaseSrcPanoImage::setProjection(), HuginBase::SrcPanoImage::setSize(), HuginBase::PanoramaOptions::setWidth(), HuginBase::ImageVariableGroup::switchParts(), HuginBase::PanoramaOptions::TIFF_m, HuginBase::PanoramaOptions::tiff_saveROI, HuginBase::ImageVariableGroup::unlinkVariablePart(), and HuginBase::ConstImageVariableGroup::updatePartNumbers().

int processPTO ( const char *  filename  ) 

Definition at line 691 of file tca_correct.cpp.

References cerr, hugin_utils::getPathPrefix(), main2(), HuginBase::Panorama::readData(), HuginBase::Panorama::setFilePrefix(), and AppBase::DocumentData::SUCCESSFUL.

Referenced by main().

static int ptinfoDlg ( int  command,
char *  argument 
) [static]

Definition at line 228 of file tca_correct.cpp.

static int ptProgress ( int  command,
char *  argument 
) [static]

Definition at line 224 of file tca_correct.cpp.

void resetValues ( HuginBase::Panorama pano  ) 

Definition at line 712 of file tca_correct.cpp.

References HuginBase::Panorama::getSrcImage(), and HuginBase::Panorama::setSrcImage().

Referenced by main2().

static void usage ( const char *  name  )  [static]

Definition at line 403 of file tca_correct.cpp.

References cout, and hugin_utils::GetHuginVersion().

double weightHuber ( double  x,
double  sigma 
) [inline]

Definition at line 251 of file tca_correct.cpp.

Variable Documentation

Parameters g_param

Definition at line 104 of file tca_correct.cpp.

Referenced by createCtrlPoints(), get_optvars(), main(), main2(), optimize_new(), optimize_old(), print_result(), and processImg().

hugin_omp::Lock lock [static]

Definition at line 439 of file tca_correct.cpp.

Generated on 17 Aug 2017 for Hugintrunk by  doxygen 1.4.7