Hugin trunk 0.1
Loading...
Searching...
No Matches
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
 
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 checkImageSizeKnown ()
 check if the image size is known, if try to load the information from the file
 
bool readEXIF ()
 try to fill out information about the image, by examining the exif data
 
bool applyEXIFValues (bool applyEVValue=true)
 apply values found in EXIF data to SrcPanoImage class, call readEXIF() before to initialize some values
 
double calcExifExposureValue ()
 calculate exposure value
 
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 lens database you need to call SrcPanoImage::readEXIF before to fill some values
 
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
 
bool readDistortionFromDB ()
 tries to read distortion data from lens database you need to call SrcPanoImage::readEXIF before to fill some values
 
bool readVignettingFromDB ()
 tries to read vignetting data from lens database you need to call SrcPanoImage::readEXIF before to fill some values
 
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
 
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
 
- Public Member Functions inherited from HuginBase::BaseSrcPanoImage
bool operator== (const BaseSrcPanoImage &other) const
 Check that the variables match.
 
 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
 
static double calcFocalLength (SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
 calcualte focal length, given crop factor and hfov
 
static double calcCropFactor (SrcPanoImage::Projection proj, double hfov, double focalLength, vigra::Size2D imageSize)
 calculate crop factor, given focal length and hfov
 

Private Member Functions

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

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

◆ SrcPanoImage() [1/2]

HuginBase::SrcPanoImage::SrcPanoImage ( )
inline

Definition at line 198 of file SrcPanoImage.h.

◆ SrcPanoImage() [2/2]

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

Definition at line 201 of file SrcPanoImage.h.

◆ ~SrcPanoImage()

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

Definition at line 208 of file SrcPanoImage.h.

Member Function Documentation

◆ addActiveMask()

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

add newMask to list of active masks

Definition at line 1036 of file SrcPanoImage.cpp.

References threshold().

◆ addMask()

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

add newMask to list of masks

Definition at line 1029 of file SrcPanoImage.cpp.

References threshold().

◆ applyEXIFValues()

bool HuginBase::SrcPanoImage::applyEXIFValues ( bool  applyEVValue = true)

◆ calcCropFactor()

double HuginBase::SrcPanoImage::calcCropFactor ( SrcPanoImage::Projection  proj,
double  hfov,
double  focalLength,
vigra::Size2D  imageSize 
)
static

◆ calcExifExposureValue()

double HuginBase::SrcPanoImage::calcExifExposureValue ( )

calculate exposure value

Definition at line 987 of file SrcPanoImage.cpp.

References threshold().

Referenced by applyEXIFValues().

◆ calcFocalLength()

double HuginBase::SrcPanoImage::calcFocalLength ( SrcPanoImage::Projection  proj,
double  hfov,
double  crop,
vigra::Size2D  imageSize 
)
static

◆ calcHFOV()

double HuginBase::SrcPanoImage::calcHFOV ( SrcPanoImage::Projection  proj,
double  fl,
double  crop,
vigra::Size2D  imageSize 
)
static

◆ changeMaskType()

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.

References threshold().

◆ checkImageSizeKnown()

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(), setSize(), and threshold().

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

◆ clearActiveMasks()

void HuginBase::SrcPanoImage::clearActiveMasks ( )

clears list of active masks

Definition at line 1043 of file SrcPanoImage.cpp.

References threshold().

◆ deleteAllMasks()

void HuginBase::SrcPanoImage::deleteAllMasks ( )

delete all masks

Definition at line 1102 of file SrcPanoImage.cpp.

References threshold().

Referenced by HuginLines::_getFilteredLines().

◆ deleteMask()

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

delete mask at index

Definition at line 1092 of file SrcPanoImage.cpp.

References threshold().

◆ getCorrectTCA()

bool HuginBase::SrcPanoImage::getCorrectTCA ( ) const

Definition at line 181 of file SrcPanoImage.cpp.

References threshold().

◆ getDBLensName()

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.

References threshold().

Referenced by ApplyLensDBParameters(), print_result(), readDistortionFromDB(), readProjectionFromDB(), readVignettingFromDB(), and SaveLensParameters().

◆ getExifDateTime()

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.

References threshold().

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

◆ getExposure()

double HuginBase::SrcPanoImage::getExposure ( ) const

◆ getHeight()

int HuginBase::SrcPanoImage::getHeight ( ) const
inline

◆ getRadialDistortionCenter()

hugin_utils::FDiff2D HuginBase::SrcPanoImage::getRadialDistortionCenter ( ) const

Definition at line 191 of file SrcPanoImage.cpp.

References threshold().

Referenced by MaskEditorPanel::setImage().

◆ getRadialVigCorrCenter()

hugin_utils::FDiff2D HuginBase::SrcPanoImage::getRadialVigCorrCenter ( ) const

◆ getVar()

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

◆ getVariableMap()

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

References DEBUG_TRACE.

◆ getWidth()

int HuginBase::SrcPanoImage::getWidth ( ) const
inline

◆ hasActiveMasks()

bool HuginBase::SrcPanoImage::hasActiveMasks ( ) const

returns true, if image has active masks

Definition at line 1070 of file SrcPanoImage.cpp.

References threshold().

Referenced by isInsideMasks().

◆ hasMasks()

bool HuginBase::SrcPanoImage::hasMasks ( ) const

returns true, if image has masks associated

Definition at line 1049 of file SrcPanoImage.cpp.

References threshold().

Referenced by HuginBase::Panorama::printPanoramaScript(), and MaskEditorPanel::UpdateImage().

◆ hasPositiveMasks()

bool HuginBase::SrcPanoImage::hasPositiveMasks ( ) const

returns true, if image has positive masks

Definition at line 1054 of file SrcPanoImage.cpp.

References threshold().

◆ horizontalWarpNeeded()

bool HuginBase::SrcPanoImage::horizontalWarpNeeded ( )

◆ isCircularCrop()

bool HuginBase::SrcPanoImage::isCircularCrop ( ) const

◆ isInside()

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

◆ isInsideMasks()

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(), and threshold().

Referenced by isInside().

◆ linkEMoRParams()

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

linking the EMOR parameters should link the correction mode.

Definition at line 340 of file SrcPanoImage.h.

References threshold().

◆ linkRadialVigCorrCenterShift()

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

linking vignetting parameters should link the vignetting correction mode

Definition at line 332 of file SrcPanoImage.h.

References threshold().

◆ linkRadialVigCorrCoeff()

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

linking vignetting parameters should link the vignetting correction mode

Definition at line 324 of file SrcPanoImage.h.

◆ linkStack()

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

Definition at line 346 of file SrcPanoImage.h.

◆ printMaskLines()

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.

References threshold().

Referenced by HuginBase::Panorama::printPanoramaScript().

◆ readCropfactorFromDB()

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::LensDB::LensDB::GetSingleton(), getSize(), and threshold().

Referenced by ImageLineList::SetFilename(), and PerspectivePanel::SetImage().

◆ readDistortionFromDB()

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::GetSingleton(), and threshold().

Referenced by PerspectivePanel::OnLoadDistortion(), and FindPanoDialog::SearchInDir().

◆ readEXIF()

bool HuginBase::SrcPanoImage::readEXIF ( )

◆ readProjectionFromDB()

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, getDBLensName(), HuginBase::LensDB::LensDB::GetSingleton(), getSize(), isCircularCrop(), HuginBase::isFisheye(), HuginBase::BaseSrcPanoImage::RECTILINEAR, setCropMode(), and threshold().

Referenced by FindPanoDialog::SearchInDir(), and ImageLineList::SetFilename().

◆ readVignettingFromDB()

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 threshold().

Referenced by FindPanoDialog::SearchInDir().

◆ resize()

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, HuginBase::BaseSrcPanoImage::NO_CROP, and threshold().

Referenced by ApplyTemplate(), HuginBase::SmallRemappedImageCache::getRemapped(), main(), and HuginBase::PointSampler::sampleAndExtractPoints().

◆ setCropMode()

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, and threshold().

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

◆ setExposure()

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

Definition at line 221 of file SrcPanoImage.cpp.

References threshold().

◆ setSize()

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

◆ setVar()

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

◆ trustExivOrientation()

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().

◆ unlinkEMoRParams()

void HuginBase::SrcPanoImage::unlinkEMoRParams ( )
inline

unlinking the EMOR parameters should unlink the correction mode.

Definition at line 316 of file SrcPanoImage.h.

References threshold().

◆ unlinkRadialVigCorrCenterShift()

void HuginBase::SrcPanoImage::unlinkRadialVigCorrCenterShift ( )
inline

unlinking vignetting parameters should unlink the vignetting correction mode

Definition at line 308 of file SrcPanoImage.h.

References threshold().

◆ unlinkRadialVigCorrCoeff()

void HuginBase::SrcPanoImage::unlinkRadialVigCorrCoeff ( )
inline

unlinking vignetting parameters should unlink the vignetting correction mode

Definition at line 300 of file SrcPanoImage.h.

◆ updateCropFactor()

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(), getSize(), and threshold().

◆ updateFocalLength()

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(), getSize(), and threshold().


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