ICF 3.0.5.47
Technical documentation of ICF Libraries
CLensCorrFindSupplierComp.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#ifndef iipr_CLensCorrFindSupplierComp_included
7#define iipr_CLensCorrFindSupplierComp_included
8
9
10// ICF includes
16#include <imeas/INumericValue.h>
18#include <iproc/IProcessor.h>
22#include <ialgo/CHoughSpace2d.h>
23
24
25namespace iipr
26{
27
28
33 public iinsp::TSupplierCompWrap< icalib::CSimpleLensCorrection >,
34 virtual public i2d::ICalibration2dProvider
35{
36public:
38
39 I_BEGIN_COMPONENT(CLensCorrFindSupplierComp);
40 I_REGISTER_INTERFACE(i2d::ICalibration2dProvider);
41 I_REGISTER_SUBELEMENT(SearchParamsConstraints);
42 I_REGISTER_SUBELEMENT_INTERFACE(SearchParamsConstraints, imeas::INumericConstraints, ExtractSearchParamsConstraints);
43 I_REGISTER_SUBELEMENT_INTERFACE(SearchParamsConstraints, istd::IChangeable, ExtractSearchParamsConstraints);
44 I_ASSIGN(m_bitmapProviderCompPtr, "BitmapProvider", "Provide input image", true, "BitmapProvider");
45 I_ASSIGN_TO(m_bitmapProviderModelCompPtr, m_bitmapProviderCompPtr, false);
46 I_ASSIGN_TO(m_bitmapProviderSupplierCompPtr, m_bitmapProviderCompPtr, false);
47 I_ASSIGN(m_pointFinderCompPtr, "PointFinder", "Finder of points on image", true, "PointFinder");
48 I_ASSIGN(m_gridSearchParamsIdAttrPtr, "GridSearchParamsId", "ID of general search parameters (imeas::INumericValue)", false, "GridSearchParams");
49 I_ASSIGN(m_defaultGridSearchParamsCompPtr, "DefaultGridSearchParams", "Default search parameters as defined in subelement DefaultSearchParamsConstraints", false, "DefaultGridSearchParams");
50 I_ASSIGN(m_smoothKernelAttrPtr, "SpaceSmoothKernel", "Size of kernel will be used to smooth hough space", true, 10);
51 I_ASSIGN(m_searchCenterParamIdAttrPtr, "SearchCenterParamId", "ID of parameter to enable search of center (iprm::IEnableableParam)", false, "SearchCenter");
52 I_ASSIGN(m_defaultSearchCenterParamCompPtr, "DefaultSearchCenterParam", "Default parameter enabling search of center", false, "DefaultSearchCenterParam");
53 I_END_COMPONENT;
54
55 // reimplemented (i2d::ICalibration2dProvider)
56 const i2d::ICalibration2d* GetCalibration() const override;
57
58protected:
60 {
61 double weight;
63 };
64
65 typedef QList<FeatureInfo> Features;
66
68 {
69 public:
70 // reimplemented (iipr::IFeaturesConsumer)
71 virtual void ResetFeatures();
72 virtual bool AddFeature(const imeas::INumericValue* featurePtr, bool* isFullPtr = nullptr);
73
75 };
76
82 typedef QList<CorrectionInfo> CorrectionInfos;
83
89 typedef QList<CorrectionLineInfo> AllCorrectionInfos;
90
92 const AllCorrectionInfos& allCorrectionInfos,
93 bool searchCenterFlag,
94 const icalib::CSimpleLensCorrection& inputCorrection,
95 icalib::CSimpleLensCorrection& result) const;
96
97 void AddCorrectPointsMessage(const AllCorrectionInfos& allCorrectionInfos, const icalib::CSimpleLensCorrection& inputCorrection, const i2d::CVector2d& imageCenter) const;
98
100 i2d::CVector2d CalcHoughPos(const i2d::CVector2d& point1, const i2d::CVector2d& point2, const i2d::CVector2d& imageCenter, const istd::CIndex2d& spaceSize) const;
101 i2d::CLine2d CalcCorrespondingLine(const i2d::CVector2d& houghPos, const i2d::CVector2d& imageCenter, const istd::CIndex2d& spaceSize) const;
102 void UpdateHoughSpace(const i2d::CVector2d& point1, const i2d::CVector2d& point2, double weight, const i2d::CVector2d& imageCenter, ialgo::CHoughSpace2d& space) const;
103
104 // reimplemented (iinsp::TSupplierCompWrap)
105 int ProduceObject(ProductType& result) const override;
106
107 // reimplemented (icomp::CComponentBase)
108 void OnComponentCreated() override;
109
110private:
111 // static template methods for sub element access
112 template <class InterfaceType>
113 static InterfaceType* ExtractSearchParamsConstraints(CLensCorrFindSupplierComp& component)
114 {
115 return const_cast<imeas::CGeneralNumericConstraints*>(&component.s_searchParamsContraints);
116 }
117
118 I_REF(iimg::IBitmapProvider, m_bitmapProviderCompPtr);
119 I_REF(imod::IModel, m_bitmapProviderModelCompPtr);
120 I_REF(iinsp::ISupplier, m_bitmapProviderSupplierCompPtr);
121 I_REF(iipr::IImageToFeatureProcessor, m_pointFinderCompPtr);
122 I_ATTR(QByteArray, m_gridSearchParamsIdAttrPtr);
123 I_REF(imeas::INumericValue, m_defaultGridSearchParamsCompPtr);
124 I_ATTR(int, m_smoothKernelAttrPtr);
125 I_ATTR(QByteArray, m_searchCenterParamIdAttrPtr);
126 I_REF(iprm::IEnableableParam, m_defaultSearchCenterParamCompPtr);
127
128 static const imath::CFixedPointManip s_integerManip;
129 static const imath::CGeneralUnitInfo s_angleGridUnitInfo;
130 static const imath::CGeneralUnitInfo s_distanceGridUnitInfo;
131 static const imath::CGeneralUnitInfo s_maxLinesUnitInfo;
132 static const imath::CGeneralUnitInfo s_minDistanceUnitInfo;
133 static const imeas::CGeneralNumericConstraints::Info s_angleGridInfo;
134 static const imeas::CGeneralNumericConstraints::Info s_distanceGridInfo;
135 static const imeas::CGeneralNumericConstraints::Info s_maxLinesInfo;
136 static const imeas::CGeneralNumericConstraints::Info s_minDistanceInfo;
137 static const imeas::CGeneralNumericConstraints s_searchParamsContraints;
138};
139
140
141} // namespace iipr
142
143
144#endif // !iipr_CLensCorrFindSupplierComp_included
145
146
Definition of a line in 2D-space.
Definition CLine2d.h:26
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Common interface for an object, which delivers a 2D-calibration.
Hough space used for 2d Hough transformations.
Represents simple correction of image distortion by lenses.
Definition of single plane bitmap.
Definition IBitmap.h:24
Bitmap supplier allowing to access of produced bitmap.
Base interface for suppliers providing calculating of objects on demand ("pull data" model).
Definition ISupplier.h:28
Standard implementation of interface iinsp::ISupplier with preparation for component implementation.
virtual bool AddFeature(const imeas::INumericValue *featurePtr, bool *isFullPtr=nullptr)
Add new feature to the set of features.
virtual void ResetFeatures()
Remove all features from this container.
Supplier of bitmap built on difference of two images.
iinsp::TSupplierCompWrap< icalib::CSimpleLensCorrection > BaseClass
const i2d::ICalibration2d * GetCalibration() const override
Get access to transformation object, which transforms a local logical coordinate system to global one...
void AddCorrectPointsMessage(const AllCorrectionInfos &allCorrectionInfos, const icalib::CSimpleLensCorrection &inputCorrection, const i2d::CVector2d &imageCenter) const
i2d::CLine2d CalcCorrespondingLine(const i2d::CVector2d &houghPos, const i2d::CVector2d &imageCenter, const istd::CIndex2d &spaceSize) const
bool CalculateCalibrationFactors(const AllCorrectionInfos &allCorrectionInfos, bool searchCenterFlag, const icalib::CSimpleLensCorrection &inputCorrection, icalib::CSimpleLensCorrection &result) const
QList< CorrectionLineInfo > AllCorrectionInfos
void OnComponentCreated() override
int ProduceObject(ProductType &result) const override
Produce single object.
i2d::CVector2d CalcHoughPos(const i2d::CVector2d &point1, const i2d::CVector2d &point2, const i2d::CVector2d &imageCenter, const istd::CIndex2d &spaceSize) const
void UpdateHoughSpace(const i2d::CVector2d &point1, const i2d::CVector2d &point2, double weight, const i2d::CVector2d &imageCenter, ialgo::CHoughSpace2d &space) const
bool CalculateCalibration(const iimg::IBitmap &image, icalib::CSimpleLensCorrection &result) const
Common interface for a features container consuming feature objects.
Allow to extract some features from the image.
Implementation of imath::IDoubleManip interface for fixed point arithmentic.
General implementation of the IUnitInfo interface.
Simple implementation of imeas::INumericConstraints interface.
Describe additional meta information for set of numeric values.
General parameter set containing list of numeric values.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
Interface for objects which can be enabled/disabled.
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy