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 <vigra/error.hxx>
#include <vigra/impex.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/lm.h>
#include <hugin_version.h>
#include <unistd.h>
#include <tiff.h>

Include dependency graph for tca_correct.cpp:

Include dependency graph

Go to the source code of this file.

Classes

struct  Parameters
struct  OptimData

Defines

#define DEFAULT_OPTIMISATION_PARAMETER   "abcvde"

Functions

void usage (const char *name)
template<class IMAGET, class ACCESSORT, class IMAGES, class ACCESSORS>
CorrelationResult PointFineTune2 (const IMAGET &templImg, ACCESSORT access_t, vigra::Diff2D templPos, int templSize, const IMAGES &searchImg, ACCESSORS access_s, vigra::Diff2D searchPos, int sWidth)
 fine tune a point with normalized cross correlation
template<class ImageType>
void createCtrlPoints (Panorama &pano, const ImageType &img, int imgRedNr, int imgGreenNr, int imgBlueNr, double scale, int nPoints, int grid)
template<class ImageType>
void createCtrlPointsOld (Panorama &pano, const ImageType &img, int imgRedNr, int imgGreenNr, int imgBlueNr, double scale, double cornerThreshold)
void get_optvars (OptimizeVector &_retval)
int optimize_old (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 (PanoramaData &pano)
int main2 (Panorama &pano)
template<class PixelType>
int processImg (const char *filename)
int processPTO (const char *filename)
void resetValues (Panorama &pano)
void print_result (Panorama &pano)
int main (int argc, char *argv[])

Variables

int g_verbose = 0
Parameters g_param


Detailed Description

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

Author:
Pablo d'Angelo <pablo.dangelo@web.de>
Id
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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition in file tca_correct.cpp.


Define Documentation

#define DEFAULT_OPTIMISATION_PARAMETER   "abcvde"
 

Definition at line 75 of file tca_correct.cpp.


Function Documentation

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

Definition at line 390 of file tca_correct.cpp.

References HuginBase::Panorama::addCtrlPoint(), cout, vigra_ext::destImage(), vigra_ext::findInterestPointsOnGrid(), g_verbose, celeste::max(), vigra_ext::CorrelationResult::maxi, vigra_ext::CorrelationResult::maxpos, PointFineTune2(), vigra_ext::srcImageRange(), vigra_ext::transformImage(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by main2(), and processImg().

template<class ImageType>
void createCtrlPointsOld Panorama pano,
const ImageType img,
int  imgRedNr,
int  imgGreenNr,
int  imgBlueNr,
double  scale,
double  cornerThreshold
 

Definition at line 492 of file tca_correct.cpp.

References HuginBase::Panorama::addCtrlPoint(), DEBUG_DEBUG, vigra_ext::destImage(), HuginBase::ControlPoint::error, g_verbose, celeste::max(), vigra_ext::CorrelationResult::maxi, vigra_ext::CorrelationResult::maxpos, PointFineTune2(), AppBase::MultiProgressDisplay::popTask(), AppBase::MultiProgressDisplay::pushTask(), AppBase::MultiProgressDisplay::setProgress(), vigra_ext::srcImage(), vigra_ext::srcImageRange(), vigra_ext::transformImage(), 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 OptimizeVector _retval  ) 
 

Definition at line 591 of file tca_correct.cpp.

References g_param, HuginBase::OptimizeVector, and Parameters::optvars.

Referenced by main2(), optimize_new(), and optimize_old().

int main int  argc,
char *  argv[]
 

Definition at line 1008 of file tca_correct.cpp.

References Parameters::blue_name, cerr, Parameters::cpErrorThreshold, g_param, g_verbose, Parameters::green_name, Parameters::grid, Parameters::load, Parameters::nPoints, Parameters::optMethod, Parameters::optvars, processPTO(), Parameters::ptoOutputFile, Parameters::red_name, Parameters::reset, Parameters::scale, and usage().

int main2 Panorama pano  ) 
 

Definition at line 967 of file tca_correct.cpp.

References cerr, Parameters::cpErrorThreshold, HuginBase::CPVector, fill_set(), g_param, g_verbose, get_optvars(), HuginBase::Panorama::getCtrlPoints(), HuginBase::Panorama::getNrOfImages(), HuginBase::Panorama::getOptions(), optimize_new(), optimize_old(), HuginBase::OptimizeVector, Parameters::optMethod, print_result(), HuginBase::Panorama::printPanoramaScript(), Parameters::ptoOutputFile, Parameters::reset, resetValues(), HuginBase::Panorama::setCtrlPoints(), and HuginBase::UIntSet.

Referenced by processImg(), and processPTO().

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

Definition at line 622 of file tca_correct.cpp.

References HuginBase::CPVector, HuginBase::ControlPoint::error, OptimData::FromX(), HuginBase::PanoramaData::getCtrlPoint(), HuginBase::PanoramaData::getNrOfCtrlPoints(), OptimData::huberSigma, HuginBase::ControlPoint::image1Nr, HuginBase::ControlPoint::image2Nr, OptimData::m_center, OptimData::m_dist, OptimData::m_hfov, OptimData::m_pano, OptimData::m_shift, celeste::min(), vigra_ext::pow(), HuginBase::PanoramaData::updateCtrlPointErrors(), weightHuber(), HuginBase::ControlPoint::x1, HuginBase::ControlPoint::x2, HuginBase::ControlPoint::y1, and HuginBase::ControlPoint::y2.

Referenced by optimize_new().

void optimize_new PanoramaData pano  ) 
 

Definition at line 704 of file tca_correct.cpp.

References g_verbose, get_optvars(), HuginBase::PanoramaData::getNrOfCtrlPoints(), OptimData::huberSigma, OptimData::m_mapping, optGetError(), HuginBase::OptimizeVector, optVis(), OptimData::SaveToImgs(), and OptimData::ToX().

Referenced by main2().

int optimize_old Panorama pano  ) 
 

Definition at line 605 of file tca_correct.cpp.

References get_optvars(), HuginBase::PTools::optimize(), HuginBase::OptimizeVector, and HuginBase::Panorama::setOptimizeVector().

Referenced by main2().

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

Definition at line 693 of file tca_correct.cpp.

Referenced by optimize_new().

template<class IMAGET, class ACCESSORT, class IMAGES, class ACCESSORS>
CorrelationResult PointFineTune2 const IMAGET &  templImg,
ACCESSORT  access_t,
vigra::Diff2D  templPos,
int  templSize,
const IMAGES &  searchImg,
ACCESSORS  access_s,
vigra::Diff2D  searchPos,
int  sWidth
 

fine tune a point with normalized cross correlation

takes a patch of templSize by templSize from templImg images at tmplPos and searches it on the searchImg, at searchPos, in a neighbourhood of sWidth by sWidth.

The result in returned in tunedPos

Returns:
correlation value

Definition at line 264 of file tca_correct.cpp.

References vigra_ext::correlateImage(), vigra_ext::correlateImageFast(), DEBUG_DEBUG, vigra_ext::destImage(), vigra_ext::CorrelationResult::maxi, vigra_ext::CorrelationResult::maxpos, hugin_utils::simpleClipPoint(), vigra_ext::srcImage(), vigra_ext::subpixelMaxima(), hugin_utils::TDiff2D< T >::toDiff2D(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by createCtrlPoints(), and createCtrlPointsOld().

void print_result Panorama pano  ) 
 

Definition at line 924 of file tca_correct.cpp.

References HuginBase::Panorama::getSrcImage(), vigra_ext::pow(), hugin_utils::roundi(), and shift.

Referenced by main2().

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

Definition at line 773 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, ImageType, vigra::importImageAlpha(), main2(), Parameters::nPoints, HuginBase::PanoramaOptions::outputFormat, Parameters::red_name, Parameters::scale, HuginBase::BaseSrcPanoImage::setExifCropFactor(), 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(), makefile::string, HuginBase::ImageVariableGroup::switchParts(), HuginBase::PanoramaOptions::tiff_saveROI, HuginBase::ImageVariableGroup::unlinkVariablePart(), and HuginBase::ConstImageVariableGroup::updatePartNumbers().

int processPTO const char *  filename  ) 
 

Definition at line 884 of file tca_correct.cpp.

References cerr, makefile::ifstream, main2(), HuginBase::Panorama::readData(), and HuginBase::Panorama::setFilePrefix().

Referenced by main().

void resetValues Panorama pano  ) 
 

Definition at line 903 of file tca_correct.cpp.

References hugin_utils::FDiff2D, HuginBase::Panorama::getSrcImage(), HuginBase::BaseSrcPanoImage::setHFOV(), HuginBase::BaseSrcPanoImage::setRadialDistortion(), HuginBase::BaseSrcPanoImage::setRadialDistortionCenterShift(), and HuginBase::Panorama::setSrcImage().

Referenced by main2().

void usage const char *  name  )  [static]
 

Definition at line 218 of file tca_correct.cpp.

References cerr.

double weightHuber double  x,
double  sigma
[inline]
 

Definition at line 614 of file tca_correct.cpp.

Referenced by optGetError().


Variable Documentation

Parameters g_param
 

Definition at line 112 of file tca_correct.cpp.

Referenced by get_optvars(), main(), main2(), and processImg().

int g_verbose = 0
 

Definition at line 77 of file tca_correct.cpp.


Generated on Mon Sep 1 01:25:47 2014 for Hugintrunk by  doxygen 1.3.9.1