ICF 3.0.5.47
Technical documentation of ICF Libraries
CSimpleLensCorrection.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// ICF includes
10#include <i2d/ICalibration2d.h>
11#include <i2d/CVector2d.h>
12
13
14namespace icalib
15{
16
17
22{
23public:
25 explicit CSimpleLensCorrection(const i2d::CVector2d& opticalCenter, double distortionFactor = 0, double scaleFactor = 1);
26
30 void Reset(const i2d::CVector2d& opticalCenter = i2d::CVector2d::GetZero(), double distortionFactor = 0, double scaleFactor = 1);
31
33 virtual void SetOpticalCenter(const i2d::CVector2d& center);
34
35 double GetDistortionFactor() const;
36 virtual void SetDistortionFactor(double factor);
37
38 double GetScaleFactor() const;
39 virtual void SetScaleFactor(double factor);
40
41 bool operator==(const CSimpleLensCorrection& calib) const;
42 bool operator!=(const CSimpleLensCorrection& calib) const;
43
44 // reimplemented (i2d::ICalibration2d)
45 const i2d::CRectangle* GetArgumentArea() const override;
46 const i2d::CRectangle* GetResultArea() const override;
47 const imath::IUnitInfo* GetArgumentUnitInfo() const override;
48 const imath::IUnitInfo* GetResultUnitInfo() const override;
49 std::unique_ptr<i2d::ICalibration2d> CreateCombinedCalibration(const ITransformation2d& transformation) const override;
50
51 // reimplemented (i2d::ITransformation2d)
52 int GetTransformationFlags() const override;
54 const i2d::CVector2d& origPos1,
55 const i2d::CVector2d& origPos2,
56 double& result,
57 ExactnessMode mode = EM_NONE) const override;
59 const i2d::CVector2d& origPosition,
60 i2d::CVector2d& result,
61 ExactnessMode mode = EM_NONE) const override;
63 const i2d::CVector2d& transfPosition,
64 i2d::CVector2d& result,
65 ExactnessMode mode = EM_NONE) const override;
67 const i2d::CVector2d& origPosition,
68 i2d::CAffine2d& result,
69 ExactnessMode mode = EM_NONE) const override;
71 const i2d::CVector2d& transfPosition,
72 i2d::CAffine2d& result,
73 ExactnessMode mode = EM_NONE) const override;
74
75 // reimplemented (imath::TISurjectFunction)
76 bool GetInvValueAt(const i2d::CVector2d& argument, i2d::CVector2d& result) const override;
77 i2d::CVector2d GetInvValueAt(const i2d::CVector2d& argument) const override;
78
79 // reimplemented (imath::TIMathFunction)
80 bool GetValueAt(const i2d::CVector2d& argument, i2d::CVector2d& result) const override;
81 i2d::CVector2d GetValueAt(const i2d::CVector2d& argument) const override;
82
83 // reimplemented (iser::ISerializable)
84 bool Serialize(iser::IArchive& archive) override;
85
86 // reimplemented (istd::IChangeable)
87 int GetSupportedOperations() const override;
88 bool CopyFrom(const istd::IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS) override;
89 bool IsEqual(const istd::IChangeable& object) const override;
90 std::unique_ptr<istd::IChangeable> CloneMe(CompatibilityMode mode = CM_WITHOUT_REFS) const override;
92
93private:
94 i2d::CVector2d m_opticalCenter;
95
96 double m_distortionFactor;
97 double m_scaleFactor;
98};
99
100
101// inline methods
102
104{
105 return !operator==(calib);
106}
107
108
109} // namespace icalib
110
111
This class defines an affine 2D-transformation.
Definition CAffine2d.h:22
Definition of rectangle area orthogonal to axis of coordination system.
Definition CRectangle.h:31
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
static const CVector2d & GetZero()
Definition CVector2d.h:306
@ EM_NONE
There are no preferences, should be automatically selected.
Represents simple correction of image distortion by lenses.
void Reset(const i2d::CVector2d &opticalCenter=i2d::CVector2d::GetZero(), double distortionFactor=0, double scaleFactor=1)
Reset this calibration, set to be identity transform.
const i2d::CRectangle * GetResultArea() const override
Get optional area where results are defined properly.
bool GetPositionAt(const i2d::CVector2d &origPosition, i2d::CVector2d &result, ExactnessMode mode=EM_NONE) const override
Get position after transformation.
CSimpleLensCorrection(const i2d::CVector2d &opticalCenter, double distortionFactor=0, double scaleFactor=1)
virtual void SetScaleFactor(double factor)
bool ResetData(CompatibilityMode mode=CM_WITHOUT_REFS) override
Reset data to its default state.
bool GetDistance(const i2d::CVector2d &origPos1, const i2d::CVector2d &origPos2, double &result, ExactnessMode mode=EM_NONE) const override
Compute a shortness distance in transformed coordinations.
bool CopyFrom(const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
Copy this object from another one.
int GetTransformationFlags() const override
Get flags of describing type of this transformation.
i2d::CVector2d GetValueAt(const i2d::CVector2d &argument) const override
const i2d::CVector2d & GetOpticalCenter() const
bool GetInvPositionAt(const i2d::CVector2d &transfPosition, i2d::CVector2d &result, ExactnessMode mode=EM_NONE) const override
Get position after transformation.
bool operator==(const CSimpleLensCorrection &calib) const
i2d::CVector2d GetInvValueAt(const i2d::CVector2d &argument) const override
const i2d::CRectangle * GetArgumentArea() const override
Get optional area where arguments are defined properly.
bool operator!=(const CSimpleLensCorrection &calib) const
int GetSupportedOperations() const override
Get set of flags for supported operations.
std::unique_ptr< i2d::ICalibration2d > CreateCombinedCalibration(const ITransformation2d &transformation) const override
double GetDistortionFactor() const
bool GetLocalTransform(const i2d::CVector2d &origPosition, i2d::CAffine2d &result, ExactnessMode mode=EM_NONE) const override
Get local transformation (from original to transformed coordinate system) at some original position.
const imath::IUnitInfo * GetArgumentUnitInfo() const override
Get unit description of calibration input (transformation function argument).
std::unique_ptr< istd::IChangeable > CloneMe(CompatibilityMode mode=CM_WITHOUT_REFS) const override
Make a copy of this object.
virtual void SetOpticalCenter(const i2d::CVector2d &center)
const imath::IUnitInfo * GetResultUnitInfo() const override
Get unit description of calibration output (transformation function result).
virtual void SetDistortionFactor(double factor)
bool GetLocalInvTransform(const i2d::CVector2d &transfPosition, i2d::CAffine2d &result, ExactnessMode mode=EM_NONE) const override
Get local transformation (from transformed to original coordinate system) at some transformed positio...
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
bool IsEqual(const istd::IChangeable &object) const override
Compare this object with another object.
bool GetInvValueAt(const i2d::CVector2d &argument, i2d::CVector2d &result) const override
bool GetValueAt(const i2d::CVector2d &argument, i2d::CVector2d &result) const override
Common interface to get information about a measurement unit.
Definition IUnitInfo.h:27
Represent input/output persistence archive.
Definition IArchive.h:33
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Contains interfaces, implementations and components related to 2D calibration and transformations.

© Witold Gantzke and Kirill Lepskiy