Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
HuginBase::SrcPanoImage Class Reference

All variables of a source image. More...

#include <SrcPanoImage.h>

Inheritance diagram for HuginBase::SrcPanoImage:
Inheritance graph

Public Member Functions

 SrcPanoImage ()
 
 SrcPanoImage (const BaseSrcPanoImage::Projection projection, const double hfov, const vigra::Size2D size)
 
virtual ~SrcPanoImage ()
 
void resize (const vigra::Size2D &size, VariableMap *potentialLinkedVars)
 "resize" image, adjusts all distortion coefficients for usage with a source image of size size potentialLinkedVars contains a map of potential linked variables which needs an update afterwards to correctly handle the linkage, when passing a nullptr these variables are directly updated in this function More...
 
bool isInside (vigra::Point2D p, bool ignoreMasks=false) const
 check if a coordinate is inside the source image More...
 
bool horizontalWarpNeeded ()
 
bool getCorrectTCA () const
 
void setCropMode (CropMode val)
 Set the crop mode. More...
 
bool isCircularCrop () const
 returns true, if projection requires cicular crop More...
 
void setSize (vigra::Size2D val)
 Set the image size in pixels. More...
 
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. More...
 
int getHeight () const
 Get the height of the image in pixels. More...
 
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. More...
 
const int getExifDateTime (struct tm *datetime) const
 try to convert Exif date time string to struct tm More...
 
void unlinkRadialVigCorrCoeff ()
 unlinking vignetting parameters should unlink the vignetting correction mode More...
 
void unlinkRadialVigCorrCenterShift ()
 unlinking vignetting parameters should unlink the vignetting correction mode More...
 
void unlinkEMoRParams ()
 unlinking the EMOR parameters should unlink the correction mode. More...
 
void linkRadialVigCorrCoeff (SrcPanoImage *target)
 linking vignetting parameters should link the vignetting correction mode More...
 
void linkRadialVigCorrCenterShift (SrcPanoImage *target)
 linking vignetting parameters should link the vignetting correction mode More...
 
void linkEMoRParams (SrcPanoImage *target)
 linking the EMOR parameters should link the correction mode. More...
 
void linkStack (SrcPanoImage *target)
 
bool checkImageSizeKnown ()
 check if the image size is known, if try to load the information from the file More...
 
bool readEXIF ()
 try to fill out information about the image, by examining the exif data More...
 
bool applyEXIFValues (bool applyEVValue=true)
 apply values found in EXIF data to SrcPanoImage class, call readEXIF() before to initialize some values More...
 
double calcExifExposureValue ()
 calculate exposure value More...
 
void updateFocalLength (double newFocalLength)
 updates the focal length, changes the hfov to reflect thew newFocalLength More...
 
void updateCropFactor (double focalLength, double newCropFactor)
 updates the crop factor, the hfov is calculates so that focal length remains the same More...
 
bool readCropfactorFromDB ()
 tries to read cropfactor from lens database you need to call SrcPanoImage::readEXIF before to fill some values More...
 
bool readProjectionFromDB (const bool ignoreFovRectilinear=true)
 tries to read projection and crop area from lens database you need to call SrcPanoImage::readEXIF before to fill some values More...
 
bool readDistortionFromDB ()
 tries to read distortion data from lens database you need to call SrcPanoImage::readEXIF before to fill some values More...
 
bool readVignettingFromDB ()
 tries to read vignetting data from lens database you need to call SrcPanoImage::readEXIF before to fill some values More...
 
std::string getDBLensName () const
 constructs the lens name for the database it is the lensname if known, for compact cameras it is constructed from camera maker and camera model More...
 
bool hasMasks () const
 returns true, if image has masks associated More...
 
bool hasPositiveMasks () const
 returns true, if image has positive masks More...
 
bool hasActiveMasks () const
 returns true, if image has active masks More...
 
void addMask (MaskPolygon newMask)
 add newMask to list of masks More...
 
void addActiveMask (MaskPolygon newMask)
 add newMask to list of active masks More...
 
void clearActiveMasks ()
 clears list of active masks More...
 
void changeMaskType (unsigned int index, HuginBase::MaskPolygon::MaskType newType)
 changes type of mask with index to given newType More...
 
void deleteMask (unsigned int index)
 delete mask at index More...
 
void deleteAllMasks ()
 delete all masks More...
 
void printMaskLines (std::ostream &o, unsigned int newImgNr) const
 writes all mask lines to stream, using given image number More...
 
bool isInsideMasks (vigra::Point2D p) const
 returns true, if point p is inside of one mask polygon More...
 
- Public Member Functions inherited from HuginBase::BaseSrcPanoImage
bool operator== (const BaseSrcPanoImage &other) const
 Check that the variables match. More...
 
 BaseSrcPanoImage ()
 
virtual ~BaseSrcPanoImage ()
 

Static Public Member Functions

static 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 More...
 
static double calcFocalLength (SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
 calcualte focal length, given crop factor and hfov More...
 
static double calcCropFactor (SrcPanoImage::Projection proj, double hfov, double focalLength, vigra::Size2D imageSize)
 calculate crop factor, given focal length and hfov More...
 

Private Member Functions

bool trustExivOrientation ()
 Check if Exiv orientation tag can be trusted. More...
 

Additional Inherited Members

- Public Types inherited from HuginBase::BaseSrcPanoImage
enum  Projection {
  RECTILINEAR = 0, PANORAMIC = 1, CIRCULAR_FISHEYE = 2, FULL_FRAME_FISHEYE = 3,
  EQUIRECTANGULAR = 4, FISHEYE_ORTHOGRAPHIC = 8, FISHEYE_STEREOGRAPHIC = 10, FISHEYE_EQUISOLID = 21,
  FISHEYE_THOBY = 20
}
 
enum  CropMode { NO_CROP =0, CROP_RECTANGLE =1, CROP_CIRCLE =2 }
 
enum  VignettingCorrMode { VIGCORR_NONE = 0, VIGCORR_RADIAL = 1, VIGCORR_FLATFIELD = 2, VIGCORR_DIV = 4 }
 vignetting correction mode (bitflags, no real enum) More...
 
enum  ResponseType {
  RESPONSE_EMOR =0, RESPONSE_LINEAR, RESPONSE_GAMMA, RESPONSE_FILE,
  RESPONSE_ICC
}
 

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 194 of file SrcPanoImage.h.

Constructor & Destructor Documentation

HuginBase::SrcPanoImage::SrcPanoImage ( )
inline

Definition at line 198 of file SrcPanoImage.h.

HuginBase::SrcPanoImage::SrcPanoImage ( const BaseSrcPanoImage::Projection  projection,
const double  hfov,
const vigra::Size2D  size 
)
inline

Definition at line 201 of file SrcPanoImage.h.

virtual HuginBase::SrcPanoImage::~SrcPanoImage ( )
inlinevirtual

Definition at line 208 of file SrcPanoImage.h.

Member Function Documentation

void HuginBase::SrcPanoImage::addActiveMask ( MaskPolygon  newMask)

add newMask to list of active masks

Definition at line 1036 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::addMask ( MaskPolygon  newMask)

add newMask to list of masks

Definition at line 1029 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::applyEXIFValues ( bool  applyEVValue = true)
double HuginBase::SrcPanoImage::calcCropFactor ( SrcPanoImage::Projection  proj,
double  hfov,
double  focalLength,
vigra::Size2D  imageSize 
)
static
double HuginBase::SrcPanoImage::calcExifExposureValue ( )

calculate exposure value

Definition at line 987 of file SrcPanoImage.cpp.

Referenced by applyEXIFValues(), and PanoOperation::ResetOperation::GetInternalCommand().

double HuginBase::SrcPanoImage::calcFocalLength ( SrcPanoImage::Projection  proj,
double  hfov,
double  crop,
vigra::Size2D  imageSize 
)
static
double HuginBase::SrcPanoImage::calcHFOV ( SrcPanoImage::Projection  proj,
double  fl,
double  crop,
vigra::Size2D  imageSize 
)
static
void HuginBase::SrcPanoImage::changeMaskType ( unsigned int  index,
HuginBase::MaskPolygon::MaskType  newType 
)

changes type of mask with index to given newType

Definition at line 1082 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::checkImageSizeKnown ( )

check if the image size is known, if try to load the information from the file

Definition at line 286 of file SrcPanoImage.cpp.

References getHeight(), getWidth(), celeste::info(), and setSize().

Referenced by GenerateSequenceDialog::DoGeneratePanorama(), and readEXIF().

void HuginBase::SrcPanoImage::clearActiveMasks ( )

clears list of active masks

Definition at line 1043 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::deleteAllMasks ( )

delete all masks

Definition at line 1102 of file SrcPanoImage.cpp.

Referenced by HuginLines::_getVerticalLines().

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

delete mask at index

Definition at line 1092 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::getCorrectTCA ( ) const
std::string HuginBase::SrcPanoImage::getDBLensName ( ) const

constructs the lens name for the database it is the lensname if known, for compact cameras it is constructed from camera maker and camera model

Definition at line 710 of file SrcPanoImage.cpp.

Referenced by ApplyLensDBParameters(), main(), print_result(), readDistortionFromDB(), readProjectionFromDB(), readVignettingFromDB(), HuginBase::LensDB::SaveLensDataFromPano(), and SaveLensParameters().

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 1136 of file SrcPanoImage.cpp.

Referenced by FillPlaceholders(), PossiblePano::GetDateTime(), FormatString::GetExifDateTime(), and BrowsePTOFilesDialog::ParsePTOFile().

double HuginBase::SrcPanoImage::getExposure ( ) const
int HuginBase::SrcPanoImage::getHeight ( ) const
inline
hugin_utils::FDiff2D HuginBase::SrcPanoImage::getRadialDistortionCenter ( ) const

Definition at line 191 of file SrcPanoImage.cpp.

Referenced by MaskEditorPanel::setImage().

hugin_utils::FDiff2D HuginBase::SrcPanoImage::getRadialVigCorrCenter ( ) const
double HuginBase::SrcPanoImage::getVar ( const std::string &  name) const
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.
int HuginBase::SrcPanoImage::getWidth ( ) const
inline
bool HuginBase::SrcPanoImage::hasActiveMasks ( ) const

returns true, if image has active masks

Definition at line 1070 of file SrcPanoImage.cpp.

Referenced by TextureManager::TextureInfo::DefineMaskTexture(), HuginBase::estimateImageAlpha(), HandleDownscaleImage(), isInsideMasks(), and RemapImage().

bool HuginBase::SrcPanoImage::hasMasks ( ) const

returns true, if image has masks associated

Definition at line 1049 of file SrcPanoImage.cpp.

Referenced by ImagesListMask::UpdateItem().

bool HuginBase::SrcPanoImage::hasPositiveMasks ( ) const

returns true, if image has positive masks

Definition at line 1054 of file SrcPanoImage.cpp.

bool HuginBase::SrcPanoImage::horizontalWarpNeeded ( )
bool HuginBase::SrcPanoImage::isCircularCrop ( ) const
bool HuginBase::SrcPanoImage::isInside ( vigra::Point2D  p,
bool  ignoreMasks = false 
) const
bool HuginBase::SrcPanoImage::isInsideMasks ( vigra::Point2D  p) const

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

Definition at line 1108 of file SrcPanoImage.cpp.

References hasActiveMasks().

Referenced by HuginBase::estimateImageAlpha(), and isInside().

void HuginBase::SrcPanoImage::linkEMoRParams ( SrcPanoImage target)
inline

linking the EMOR parameters should link the correction mode.

Definition at line 340 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::linkRadialVigCorrCenterShift ( SrcPanoImage target)
inline

linking vignetting parameters should link the vignetting correction mode

Definition at line 332 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::linkRadialVigCorrCoeff ( SrcPanoImage target)
inline

linking vignetting parameters should link the vignetting correction mode

Definition at line 324 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::linkStack ( SrcPanoImage target)
inline

Definition at line 346 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 1075 of file SrcPanoImage.cpp.

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

bool HuginBase::SrcPanoImage::readCropfactorFromDB ( )

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

Returns
true, if information could be read from database

Definition at line 687 of file SrcPanoImage.cpp.

References calcHFOV(), HuginBase::Exiv2Helper::getCropFactor(), HuginBase::LensDB::LensDB::GetSingleton(), and getSize().

Referenced by PanoCommand::wxAddImagesCmd::processPanorama().

bool HuginBase::SrcPanoImage::readDistortionFromDB ( )

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

Returns
true, if information could be read from database

Definition at line 817 of file SrcPanoImage.cpp.

References getDBLensName(), HuginBase::LensDB::LensDB::GetDistortion(), and HuginBase::LensDB::LensDB::GetSingleton().

Referenced by main(), and main2().

bool HuginBase::SrcPanoImage::readEXIF ( )
bool HuginBase::SrcPanoImage::readProjectionFromDB ( const bool  ignoreFovRectilinear = true)

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

Parameters
ignoreFovRectilinearif this parameter is true, the fov of rectilinear is not read from the database, otherwise the hfov is populated with the value from the database
Returns
true, if information could be read from database

Definition at line 747 of file SrcPanoImage.cpp.

References calcFocalLength(), calcHFOV(), HuginBase::BaseSrcPanoImage::CROP_CIRCLE, HuginBase::BaseSrcPanoImage::CROP_RECTANGLE, HuginBase::LensDB::LensDB::GetCrop(), HuginBase::Exiv2Helper::getCropFactor(), getDBLensName(), HuginBase::LensDB::LensDB::GetDistortion(), HuginBase::LensDB::LensDB::GetFov(), HuginBase::LensDB::LensDB::GetProjection(), HuginBase::LensDB::LensDB::GetSingleton(), getSize(), isCircularCrop(), HuginBase::isFisheye(), HuginBase::BaseSrcPanoImage::RECTILINEAR, and setCropMode().

Referenced by main(), and PanoCommand::wxAddImagesCmd::processPanorama().

bool HuginBase::SrcPanoImage::readVignettingFromDB ( )

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

Returns
true, if information could be read from database

Definition at line 838 of file SrcPanoImage.cpp.

References getDBLensName(), HuginBase::LensDB::LensDB::GetSingleton(), and HuginBase::LensDB::LensDB::GetVignetting().

Referenced by main().

void HuginBase::SrcPanoImage::resize ( const vigra::Size2D &  size,
VariableMap potentialLinkedVars 
)

"resize" image, adjusts all distortion coefficients for usage with a source image of size size potentialLinkedVars contains a map of potential linked variables which needs an update afterwards to correctly handle the linkage, when passing a nullptr these variables are directly updated in this function

Definition at line 55 of file SrcPanoImage.cpp.

References HuginBase::BaseSrcPanoImage::CROP_CIRCLE, HuginBase::BaseSrcPanoImage::CROP_RECTANGLE, and HuginBase::BaseSrcPanoImage::NO_CROP.

Referenced by ApplyTemplate(), HuginBase::SmallRemappedImageCache::getRemapped(), main(), PanoCommand::wxLoadPTProjectCmd::processPanorama(), PanoCommand::wxApplyTemplateCmd::processPanorama(), and HuginBase::PointSampler::sampleAndExtractPoints().

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 202 of file SrcPanoImage.cpp.

References HuginBase::BaseSrcPanoImage::NO_CROP.

Referenced by main(), HFOVDialog::OnLoadLensParameters(), and readProjectionFromDB().

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

Definition at line 221 of file SrcPanoImage.cpp.

void HuginBase::SrcPanoImage::setSize ( vigra::Size2D  val)
void HuginBase::SrcPanoImage::setVar ( const std::string &  name,
double  val 
)
bool HuginBase::SrcPanoImage::trustExivOrientation ( )
private

Check if Exiv orientation tag can be trusted.

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 1128 of file SrcPanoImage.cpp.

References getSize().

Referenced by readEXIF().

void HuginBase::SrcPanoImage::unlinkEMoRParams ( )
inline

unlinking the EMOR parameters should unlink the correction mode.

Definition at line 316 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::unlinkRadialVigCorrCenterShift ( )
inline

unlinking vignetting parameters should unlink the vignetting correction mode

Definition at line 308 of file SrcPanoImage.h.

void HuginBase::SrcPanoImage::unlinkRadialVigCorrCoeff ( )
inline

unlinking vignetting parameters should unlink the vignetting correction mode

Definition at line 300 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 1018 of file SrcPanoImage.cpp.

References calcHFOV(), and getSize().

void HuginBase::SrcPanoImage::updateFocalLength ( double  newFocalLength)

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

Definition at line 1009 of file SrcPanoImage.cpp.

References calcHFOV(), HuginBase::Exiv2Helper::getCropFactor(), and getSize().


The documentation for this class was generated from the following files: