HuginBase::SrcPanoImage Class Reference

All variables of a source image. More...

#include <SrcPanoImage.h>

Inheritance diagram for HuginBase::SrcPanoImage:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 SrcPanoImage ()
virtual ~SrcPanoImage ()
 SrcPanoImage (const std::string &filename)
 initialize a SrcPanoImage from a file.
const bool hasEXIFread () const
 return true, if EXIF infomation was read sucessful
void resize (const vigra::Size2D &size)
 "resize" image, adjusts all distortion coefficients for usage with a source image of size size
bool isInside (vigra::Point2D p, bool ignoreMasks=false) const
 check if a coordinate is inside the source image
bool horizontalWarpNeeded ()
bool getCorrectTCA () const
void setCropMode (CropMode val)
 Set the crop mode.
bool isCircularCrop () const
 returns true, if projection requires cicular crop
void setSize (vigra::Size2D val)
 Set the image size in pixels.
hugin_utils::FDiff2D getRadialDistortionCenter () const
hugin_utils::FDiff2D getRadialVigCorrCenter () const
double getExposure () const
void setExposure (const double &val)
int getWidth () const
 Get the width of the image in pixels.
int getHeight () const
 Get the height of the image in pixels.
double getVar (const std::string &name) const
void setVar (const std::string &name, double val)
VariableMap getVariableMap () const
 Return all the image variables in a variable map.
const int getExifDateTime (struct tm *datetime) const
 try to convert Exif date time string to struct tm
void unlinkRadialVigCorrCoeff ()
 unlinking vignetting parameters should unlink the vignetting correction mode
void unlinkRadialVigCorrCenterShift ()
 unlinking vignetting parameters should unlink the vignetting correction mode
void unlinkEMoRParams ()
 unlinking the EMOR parameters should unlink the correction mode.
void linkRadialVigCorrCoeff (SrcPanoImage *target)
 linking vignetting parameters should link the vignetting correction mode
void linkRadialVigCorrCenterShift (SrcPanoImage *target)
 linking vignetting parameters should link the vignetting correction mode
void linkEMoRParams (SrcPanoImage *target)
 linking the EMOR parameters should link the correction mode.
void linkStack (SrcPanoImage *target)
bool readEXIF (double &focalLength, double &cropFactor, bool applyEXIF, bool applyExposureValue)
 try to fill out information about the image, by examining the exif data focalLength and cropFactor will be updated with the ones read from the exif data If no or not enought exif data was found and valid given focalLength and cropFactor settings where provided, they will be used for computation of the HFOV.
bool readEXIF (double &focalLength, double &cropFactor, double &eV, bool applyEXIF, bool applyExposureValue)
void updateFocalLength (double newFocalLength)
 updates the focal length, changes the hfov to reflect thew newFocalLength
void updateCropFactor (double focalLength, double newCropFactor)
 updates the crop factor, the hfov is calculates so that focal length remains the same
bool readCropfactorFromDB ()
 tries to read cropfactor from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values
bool readProjectionFromDB ()
 tries to read projection and crop area from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values
bool readDistortionFromDB ()
 tries to read distortion data from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values
bool readVignettingFromDB ()
 tries to read vignetting data from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values
bool hasMasks () const
 returns true, if image has masks associated
bool hasPositiveMasks () const
 returns true, if image has positive masks
bool hasActiveMasks () const
 returns true, if image has active masks
void addMask (MaskPolygon newMask)
 add newMask to list of masks
void addActiveMask (MaskPolygon newMask)
 add newMask to list of active masks
void clearActiveMasks ()
 clears list of active masks
void changeMaskType (unsigned int index, HuginBase::MaskPolygon::MaskType newType)
 changes type of mask with index to given newType
void deleteMask (unsigned int index)
 delete mask at index
void deleteAllMasks ()
 delete all masks
void printMaskLines (std::ostream &o, unsigned int newImgNr) const
 writes all mask lines to stream, using given image number
bool isInsideMasks (vigra::Point2D p) const
 returns true, if point p is inside of one mask polygon

Static Public Member Functions

double calcHFOV (SrcPanoImage::Projection proj, double fl, double crop, vigra::Size2D imageSize)
 calculate hfov of an image given focal length, image size and crop factor
double calcFocalLength (SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
 calcualte focal length, given crop factor and hfov
double calcCropFactor (SrcPanoImage::Projection proj, double hfov, double focalLength, vigra::Size2D imageSize)
 calculate crop factor, given focal length and hfov

Private Member Functions

bool getExiv2Value (Exiv2::ExifData &exifData, std::string keyName, long &value)
 convenience functions to work with Exiv2
bool getExiv2Value (Exiv2::ExifData &exifData, std::string keyName, float &value)
bool getExiv2Value (Exiv2::ExifData &exifData, std::string keyName, std::string &value)
bool getExiv2Value (Exiv2::ExifData &exifData, uint16_t tagID, std::string groupName, std::string &value)
bool trustExivOrientation ()
 Decides if the Exiv Orientation Tag of an images is plausible.

Private Attributes

bool successfullEXIFread

Detailed Description

All variables of a source image.

In the long term, this simplified class will replace PanoImage and Image options and the variables array. All image variables are stored in this class, regardless of what the variable is attached to (lens, sensor, position).

Definition at line 1455 of file SrcPanoImage.h.


Constructor & Destructor Documentation

HuginBase::SrcPanoImage::SrcPanoImage  )  [inline]
 

Definition at line 1459 of file SrcPanoImage.h.

virtual HuginBase::SrcPanoImage::~SrcPanoImage  )  [inline, virtual]
 

Definition at line 1465 of file SrcPanoImage.h.

HuginBase::SrcPanoImage::SrcPanoImage const std::string filename  )  [inline]
 

initialize a SrcPanoImage from a file.

Will read image size and EXIF data to initialize as many fields as possible (most importatly HFOV and exposure value)

Definition at line 1471 of file SrcPanoImage.h.


Member Function Documentation

void HuginBase::SrcPanoImage::addActiveMask MaskPolygon  newMask  ) 
 

add newMask to list of active masks

Definition at line 1773 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::addMask MaskPolygon  newMask  ) 
 

add newMask to list of masks

Definition at line 1766 of file SrcPanoImage.cpp.

double HuginBase::SrcPanoImage::calcCropFactor SrcPanoImage::Projection  proj,
double  hfov,
double  focalLength,
vigra::Size2D  imageSize
[static]
 

calculate crop factor, given focal length and hfov

Definition at line 1656 of file SrcPanoImage.cpp.

Referenced by PT::calcCropFactor().

double HuginBase::SrcPanoImage::calcFocalLength SrcPanoImage::Projection  proj,
double  hfov,
double  crop,
vigra::Size2D  imageSize
[static]
 

calcualte focal length, given crop factor and hfov

Definition at line 1611 of file SrcPanoImage.cpp.

Referenced by HuginLines::_getVerticalLines(), and PT::calcFocalLength().

double HuginBase::SrcPanoImage::calcHFOV SrcPanoImage::Projection  proj,
double  fl,
double  crop,
vigra::Size2D  imageSize
[static]
 

calculate hfov of an image given focal length, image size and crop factor

Definition at line 1560 of file SrcPanoImage.cpp.

Referenced by PT::calcHFOV(), LensCalImageCtrl::GenerateRemappedImage(), and ImagesPanel::OnFocalLengthChanged().

void HuginBase::SrcPanoImage::changeMaskType unsigned int  index,
HuginBase::MaskPolygon::MaskType  newType
 

changes type of mask with index to given newType

Definition at line 1819 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::clearActiveMasks  ) 
 

clears list of active masks

Definition at line 1780 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::deleteAllMasks  ) 
 

delete all masks

Definition at line 1839 of file SrcPanoImage.cpp.

Referenced by HuginLines::_getVerticalLines(), and PT::wxAddImagesCmd::processPanorama().

void HuginBase::SrcPanoImage::deleteMask unsigned int  index  ) 
 

delete mask at index

Definition at line 1829 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::getCorrectTCA  )  const
 

Definition at line 327 of file SrcPanoImage.cpp.

Referenced by correctImage(), HuginBase::Nona::estScaleFactorForFullFrame(), HuginBase::Nona::SpaceTransform::InitInvRadialCorrect(), and HuginBase::Nona::SpaceTransform::InitRadialCorrect().

const int HuginBase::SrcPanoImage::getExifDateTime struct tm *  datetime  )  const
 

try to convert Exif date time string to struct tm

Returns:
0, if conversion was sucessfull

Definition at line 1873 of file SrcPanoImage.cpp.

Referenced by FillPlaceholders(), PossiblePano::GetDateTime(), and ImagesTreeCtrl::UpdateImageText().

bool HuginBase::SrcPanoImage::getExiv2Value Exiv2::ExifData &  exifData,
uint16_t  tagID,
std::string  groupName,
std::string value
[private]
 

Definition at line 1750 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::getExiv2Value Exiv2::ExifData &  exifData,
std::string  keyName,
std::string value
[private]
 

Definition at line 1737 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::getExiv2Value Exiv2::ExifData &  exifData,
std::string  keyName,
float &  value
[private]
 

Definition at line 1723 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::getExiv2Value Exiv2::ExifData &  exifData,
std::string  keyName,
long &  value
[private]
 

convenience functions to work with Exiv2

Definition at line 1709 of file SrcPanoImage.cpp.

double HuginBase::SrcPanoImage::getExposure  )  const
 

Definition at line 360 of file SrcPanoImage.cpp.

Referenced by PreviewDifferenceTool::AfterDrawImagesEvent(), AutoPanoSiftMultiRowStack::automatch(), AutoPanoSiftStack::automatch(), TextureManager::DrawImage(), HuginBase::Photometric::ResponseTransform< VTIn >::initWithSrcImg(), PanoDetector::matchMultiRow(), and TextureManager::TextureKey::SetOptions().

int HuginBase::SrcPanoImage::getHeight  )  const [inline]
 

Get the height of the image in pixels.

Should not be used, use getSize().height() instead. This is here for compatiblity with PnaoImage, but should be removed.

Todo:
replace all calls to getHeight() with getSize().height().

Definition at line 1547 of file SrcPanoImage.h.

Referenced by HuginLines::_getVerticalLines(), HuginBase::PTools::Transform::createInvTransform(), HuginBase::PTools::Transform::createTransform(), TextureManager::TextureInfo::DefineMaskTexture(), CPEditorPanel::EstimatePoint(), CPEditorPanel::OnTextPointChange(), and PT::wxAddCtrlPointGridCmd::processPanorama().

FDiff2D HuginBase::SrcPanoImage::getRadialDistortionCenter  )  const
 

Definition at line 337 of file SrcPanoImage.cpp.

Referenced by MaskEditorPanel::setImage().

FDiff2D HuginBase::SrcPanoImage::getRadialVigCorrCenter  )  const
 

Definition at line 341 of file SrcPanoImage.cpp.

Referenced by HuginBase::Photometric::ResponseTransform< VTIn >::initWithSrcImg().

double HuginBase::SrcPanoImage::getVar const std::string name  )  const
 

Definition at line 537 of file SrcPanoImage.cpp.

Referenced by HuginBase::OptVarSpec::get(), HuginBase::PTOptEstimator::leastSquaresEstimate(), ImagesTreeCtrl::OnBeginEdit(), LensCalFrame::Optimize(), and UpdateSingleVar().

VariableMap HuginBase::SrcPanoImage::getVariableMap  )  const
 

Return all the image variables in a variable map.

Returns a map of all the variables for this image. It is adivisable to use the individual getX functions where apropriate instead.

Todo:
remove this infavour of the individual get*() functions. This creates a map of all the variables, regardless of which ones are actually needed, every time it is called.

Definition at line 882 of file SrcPanoImage.cpp.

int HuginBase::SrcPanoImage::getWidth  )  const [inline]
 

Get the width of the image in pixels.

Should not be used, use getSize().width() instead. This is here for compatiblity with PnaoImage, but should be removed.

Todo:
replace all calls to getWidth() with getSize().width().

Definition at line 1537 of file SrcPanoImage.h.

Referenced by HuginLines::_getVerticalLines(), HuginBase::PTools::Transform::createInvTransform(), HuginBase::PTools::Transform::createTransform(), TextureManager::TextureInfo::DefineMaskTexture(), CPEditorPanel::estimateAndAddOtherPoint(), CPEditorPanel::EstimatePoint(), CPEditorPanel::NewPointChange(), CPEditorPanel::OnTextPointChange(), and PT::wxAddCtrlPointGridCmd::processPanorama().

bool HuginBase::SrcPanoImage::hasActiveMasks  )  const
 

returns true, if image has active masks

Definition at line 1807 of file SrcPanoImage.cpp.

Referenced by PanoDetector::AnalyzeImage(), TextureManager::TextureInfo::DefineMaskTexture(), HuginBase::estimateImageAlpha(), and HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage().

const bool HuginBase::SrcPanoImage::hasEXIFread  )  const [inline]
 

return true, if EXIF infomation was read sucessful

Definition at line 1480 of file SrcPanoImage.h.

Referenced by LensCalFrame::AddImages(), main(), SaveLensParameters(), and FindPanoDialog::SearchInDir().

bool HuginBase::SrcPanoImage::hasMasks  )  const
 

returns true, if image has masks associated

Definition at line 1786 of file SrcPanoImage.cpp.

Referenced by ImagesListMask::UpdateItem().

bool HuginBase::SrcPanoImage::hasPositiveMasks  )  const
 

returns true, if image has positive masks

Definition at line 1791 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::horizontalWarpNeeded  ) 
 

Definition at line 98 of file SrcPanoImage.cpp.

References HuginBase::ImageVariable< Type >::getData().

Referenced by HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::remapImage().

bool HuginBase::SrcPanoImage::isCircularCrop  )  const
 

returns true, if projection requires cicular crop

Definition at line 321 of file SrcPanoImage.cpp.

Referenced by main(), and MaskEditorPanel::setImage().

bool HuginBase::SrcPanoImage::isInside vigra::Point2D  p,
bool  ignoreMasks = false
const
 

check if a coordinate is inside the source image

Definition at line 292 of file SrcPanoImage.cpp.

References celeste::info().

Referenced by applyMaskAndCrop(), HuginBase::Nona::RemappedPanoImage< RemapImage, AlphaImage >::calcAlpha(), PreviewColorPickerTool::CalcCorrection(), HuginBase::CalculateImageOverlap::calculate(), CheckAndAddPoint(), HuginBase::getCPinMasks(), VertexCoordRemapper::GetNextFaceCoordinates(), TexCoordRemapper::GetNextFaceCoordinates(), HuginBase::CalculateOptimalROI::stackPixel(), PlaneOverviewToolHelper::UpdateImagesUnderMouse(), PanosphereOverviewToolHelper::UpdateImagesUnderMouse(), PreviewToolHelper::UpdateImagesUnderMouse(), and PreviewLayoutLinesTool::updateLineInformation().

bool HuginBase::SrcPanoImage::isInsideMasks vigra::Point2D  p  )  const
 

returns true, if point p is inside of one mask polygon

Definition at line 1845 of file SrcPanoImage.cpp.

Referenced by HuginBase::estimateImageAlpha().

void HuginBase::SrcPanoImage::linkEMoRParams SrcPanoImage target  )  [inline]
 

linking the EMOR parameters should link the correction mode.

Definition at line 1611 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::linkRadialVigCorrCenterShift SrcPanoImage target  )  [inline]
 

linking vignetting parameters should link the vignetting correction mode

Definition at line 1603 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::linkRadialVigCorrCoeff SrcPanoImage target  )  [inline]
 

linking vignetting parameters should link the vignetting correction mode

Definition at line 1595 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::linkStack SrcPanoImage target  )  [inline]
 

Definition at line 1617 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::printMaskLines std::ostream o,
unsigned int  newImgNr
const
 

writes all mask lines to stream, using given image number

Definition at line 1812 of file SrcPanoImage.cpp.

Referenced by TextureManager::TextureKey::SetOptions().

bool HuginBase::SrcPanoImage::readCropfactorFromDB  ) 
 

tries to read cropfactor from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values

Returns:
true, if information could be read from database

Definition at line 1426 of file SrcPanoImage.cpp.

Referenced by PT::wxAddImagesCmd::processPanorama(), and ImageLineList::SetFilename().

bool HuginBase::SrcPanoImage::readDistortionFromDB  ) 
 

tries to read distortion data from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values

Returns:
true, if information could be read from database

Definition at line 1512 of file SrcPanoImage.cpp.

Referenced by main(), and FindPanoDialog::SearchInDir().

bool HuginBase::SrcPanoImage::readEXIF double &  focalLength,
double &  cropFactor,
double &  eV,
bool  applyEXIF,
bool  applyExposureValue
 

Definition at line 1062 of file SrcPanoImage.cpp.

References HuginBase::ImageVariable< Type >::getData().

bool HuginBase::SrcPanoImage::readEXIF double &  focalLength,
double &  cropFactor,
bool  applyEXIF,
bool  applyExposureValue
 

try to fill out information about the image, by examining the exif data focalLength and cropFactor will be updated with the ones read from the exif data If no or not enought exif data was found and valid given focalLength and cropFactor settings where provided, they will be used for computation of the HFOV.

Definition at line 1056 of file SrcPanoImage.cpp.

References HuginBase::MaskPolygonVector.

Referenced by HuginBase::StraightenPanorama::calcStraighteningRotation(), PanoOperation::ResetOperation::GetInternalCommand(), PT::initImageFromFile(), main(), main2(), PT::wxLoadPTProjectCmd::processPanorama(), and PT::wxAddImagesCmd::processPanorama().

bool HuginBase::SrcPanoImage::readProjectionFromDB  ) 
 

tries to read projection and crop area from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values

Returns:
true, if information could be read from database

Definition at line 1444 of file SrcPanoImage.cpp.

Referenced by main(), PT::wxAddImagesCmd::processPanorama(), FindPanoDialog::SearchInDir(), and ImageLineList::SetFilename().

bool HuginBase::SrcPanoImage::readVignettingFromDB  ) 
 

tries to read vignetting data from lensfun database you need to call SrcPanoImage::readEXIF before to fill some values

Returns:
true, if information could be read from database

Definition at line 1538 of file SrcPanoImage.cpp.

Referenced by main(), and FindPanoDialog::SearchInDir().

void HuginBase::SrcPanoImage::resize const vigra::Size2D &  size  ) 
 

"resize" image, adjusts all distortion coefficients for usage with a source image of size size

Definition at line 57 of file SrcPanoImage.cpp.

References HuginBase::ImageVariable< Type >::getData(), HuginBase::MaskPolygonVector, and HuginBase::ImageVariable< Type >::setData().

Referenced by A_Polygon::A_Polygon(), PanoDetector::AnalyzeImage(), HuginBase::CalculateImageOverlap::calculate(), correctRGB(), HuginBase::estimateImageAlpha(), PanoOperation::CelesteOperation::GetInternalCommand(), getPTLensCoef(), HuginBase::SmallRemappedImageCache::getRemapped(), HuginBase::Photometric::ResponseTransform< VTIn >::initWithSrcImg(), main(), PT::wxApplyTemplateCmd::processPanorama(), PT::wxLoadPTProjectCmd::processPanorama(), HuginBase::PointSampler::sampleAndExtractPoints(), and PreviewPanel::updatePreview().

void HuginBase::SrcPanoImage::setCropMode CropMode  val  ) 
 

Set the crop mode.

This sets the cropping region to the entire image when set to NO_CROP, unlike the lazy metaprogrammed equivalent in BaseSrcPanoImage.

Definition at line 344 of file SrcPanoImage.cpp.

Referenced by main().

void HuginBase::SrcPanoImage::setExposure const double &  val  ) 
 

Definition at line 363 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::setSize vigra::Size2D  val  ) 
 

Set the image size in pixels.

If we aren't cropping the image, set the size to the entire image

Reimplemented from HuginBase::BaseSrcPanoImage.

Definition at line 352 of file SrcPanoImage.cpp.

Referenced by HuginBase::Nona::SpaceTransform::createInvTransform(), PanosphereOverviewProjectionGridTool::createMesh(), PreviewProjectionGridTool::createMesh(), HuginBase::Nona::SpaceTransform::createTransform(), OverviewOutlinesTool::DrawRect(), HuginBase::CalculateFitPanorama::fitPano(), HuginBase::PanoramaOptions::getVFOV(), GreatCircleArc::GreatCircleArc(), main(), ImageVariableDialog::OnShowDistortionGraph(), ImageVariableDialog::OnShowVignettingGraph(), OutputProjectionInfo::OutputProjectionInfo(), processImg(), PT::wxApplyTemplateCmd::processPanorama(), HuginBase::PanoramaOptions::setVFOV(), and PreviewPanel::updatePreview().

void HuginBase::SrcPanoImage::setVar const std::string name,
double  val
 

Definition at line 710 of file SrcPanoImage.cpp.

Referenced by HuginBase::Nona::SpaceTransform::createInvTransform(), HuginBase::Nona::SpaceTransform::createTransform(), LensCalImageCtrl::GenerateRemappedImage(), and LensCalFrame::GetPanorama().

bool HuginBase::SrcPanoImage::trustExivOrientation  )  [private]
 

Decides if the Exiv Orientation Tag of an images is plausible.

Current checks:

  • If width is smaller than height, image is probably already rotated, tag may be wrong.
    Returns:
    true if plausible.

Definition at line 1865 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::unlinkEMoRParams  )  [inline]
 

unlinking the EMOR parameters should unlink the correction mode.

Reimplemented from HuginBase::BaseSrcPanoImage.

Definition at line 1587 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::unlinkRadialVigCorrCenterShift  )  [inline]
 

unlinking vignetting parameters should unlink the vignetting correction mode

Reimplemented from HuginBase::BaseSrcPanoImage.

Definition at line 1579 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::unlinkRadialVigCorrCoeff  )  [inline]
 

unlinking vignetting parameters should unlink the vignetting correction mode

Reimplemented from HuginBase::BaseSrcPanoImage.

Definition at line 1571 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::updateCropFactor double  focalLength,
double  newCropFactor
 

updates the crop factor, the hfov is calculates so that focal length remains the same

Definition at line 1698 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::updateFocalLength double  newFocalLength  ) 
 

updates the focal length, changes the hfov to reflect thew newFocalLength

Definition at line 1689 of file SrcPanoImage.cpp.


Member Data Documentation

bool HuginBase::SrcPanoImage::successfullEXIFread [private]
 

Definition at line 1692 of file SrcPanoImage.h.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 01:25:49 2014 for Hugintrunk by  doxygen 1.3.9.1