CLensCorrFindSupplierComp.h
Go to the documentation of this file.
1 #ifndef iipr_CLensCorrFindSupplierComp_included
2 #define iipr_CLensCorrFindSupplierComp_included
3 
4 
5 // ACF includes
10 #include <iimg/IBitmapProvider.h>
11 
12 // ACF-Solutions includes
13 #include <imeas/INumericValue.h>
15 #include <iproc/IProcessor.h>
19 #include <ialgo/CHoughSpace2d.h>
20 
21 
22 namespace iipr
23 {
24 
25 
30  public iinsp::TSupplierCompWrap< icalib::CSimpleLensCorrection >,
31  virtual public i2d::ICalibrationProvider
32 {
33 public:
35 
36  I_BEGIN_COMPONENT(CLensCorrFindSupplierComp);
37  I_REGISTER_INTERFACE(i2d::ICalibrationProvider);
38  I_REGISTER_SUBELEMENT(SearchParamsConstraints);
39  I_REGISTER_SUBELEMENT_INTERFACE(SearchParamsConstraints, imeas::INumericConstraints, ExtractSearchParamsConstraints);
40  I_REGISTER_SUBELEMENT_INTERFACE(SearchParamsConstraints, istd::IChangeable, ExtractSearchParamsConstraints);
41  I_ASSIGN(m_bitmapProviderCompPtr, "BitmapProvider", "Provide input image", true, "BitmapProvider");
42  I_ASSIGN_TO(m_bitmapProviderModelCompPtr, m_bitmapProviderCompPtr, false);
43  I_ASSIGN_TO(m_bitmapProviderSupplierCompPtr, m_bitmapProviderCompPtr, false);
44  I_ASSIGN(m_pointFinderCompPtr, "PointFinder", "Finder of points on image", true, "PointFinder");
45  I_ASSIGN(m_gridSearchParamsIdAttrPtr, "GridSearchParamsId", "ID of general search parameters (imeas::INumericValue)", false, "GridSearchParams");
46  I_ASSIGN(m_defaultGridSearchParamsCompPtr, "DefaultGridSearchParams", "Default search parameters as defined in subelement DefaultSearchParamsConstraints", false, "DefaultGridSearchParams");
47  I_ASSIGN(m_smoothKernelAttrPtr, "SpaceSmoothKernel", "Size of kernel will be used to smooth hough space", true, 10);
48  I_ASSIGN(m_searchCenterParamIdAttrPtr, "SearchCenterParamId", "ID of parameter to enable search of center (iprm::IEnableableParam)", false, "SearchCenter");
49  I_ASSIGN(m_defaultSearchCenterParamCompPtr, "DefaultSearchCenterParam", "Default parameter enabling search of center", false, "DefaultSearchCenterParam");
50  I_END_COMPONENT;
51 
52  // reimplemented (i2d::ICalibrationProvider)
53  virtual const i2d::ICalibration2d* GetCalibration() const;
54 
55 protected:
56  struct FeatureInfo
57  {
58  double weight;
60  };
61 
62  typedef QList<FeatureInfo> Features;
63 
65  {
66  public:
67  // reimplemented (iipr::IFeaturesConsumer)
68  virtual void ResetFeatures();
69  virtual bool AddFeature(const imeas::INumericValue* featurePtr, bool* isFullPtr = NULL);
70 
72  };
73 
75  {
78  };
79  typedef QList<CorrectionInfo> CorrectionInfos;
80 
82  {
85  };
86  typedef QList<CorrectionLineInfo> AllCorrectionInfos;
87 
89  const AllCorrectionInfos& allCorrectionInfos,
90  bool searchCenterFlag,
91  const icalib::CSimpleLensCorrection& inputCorrection,
92  icalib::CSimpleLensCorrection& result) const;
93 
94  void AddCorrectPointsMessage(const AllCorrectionInfos& allCorrectionInfos, const icalib::CSimpleLensCorrection& inputCorrection, const i2d::CVector2d& imageCenter) const;
95 
96  bool CalculateCalibration(const iimg::IBitmap& image, icalib::CSimpleLensCorrection& result) const;
97  i2d::CVector2d CalcHoughPos(const i2d::CVector2d& point1, const i2d::CVector2d& point2, const i2d::CVector2d& imageCenter, const istd::CIndex2d& spaceSize) const;
98  i2d::CLine2d CalcCorrespondingLine(const i2d::CVector2d& houghPos, const i2d::CVector2d& imageCenter, const istd::CIndex2d& spaceSize) const;
99  void UpdateHoughSpace(const i2d::CVector2d& point1, const i2d::CVector2d& point2, double weight, const i2d::CVector2d& imageCenter, ialgo::CHoughSpace2d& space) const;
100 
101  // reimplemented (iinsp::TSupplierCompWrap)
102  virtual int ProduceObject(ProductType& result) const;
103 
104  // reimplemented (icomp::CComponentBase)
105  virtual void OnComponentCreated();
106 
107 private:
108  // static template methods for sub element access
109  template <class InterfaceType>
110  static InterfaceType* ExtractSearchParamsConstraints(CLensCorrFindSupplierComp& component)
111  {
112  return &component.m_searchParamsContraints;
113  }
114 
115  I_REF(iimg::IBitmapProvider, m_bitmapProviderCompPtr);
116  I_REF(imod::IModel, m_bitmapProviderModelCompPtr);
117  I_REF(iinsp::ISupplier, m_bitmapProviderSupplierCompPtr);
118  I_REF(iipr::IImageToFeatureProcessor, m_pointFinderCompPtr);
119  I_ATTR(QByteArray, m_gridSearchParamsIdAttrPtr);
120  I_REF(imeas::INumericValue, m_defaultGridSearchParamsCompPtr);
121  I_ATTR(int, m_smoothKernelAttrPtr);
122  I_ATTR(QByteArray, m_searchCenterParamIdAttrPtr);
123  I_REF(iprm::IEnableableParam, m_defaultSearchCenterParamCompPtr);
124 
125  imeas::CGeneralNumericConstraints m_searchParamsContraints;
126 
127  static imath::CFixedPointManip s_integerManip;
128  static imath::CGeneralUnitInfo s_angleGridUnitInfo;
129  static imath::CGeneralUnitInfo s_distanceGridUnitInfo;
130  static imath::CGeneralUnitInfo s_maxLinesUnitInfo;
131  static imath::CGeneralUnitInfo s_minDistanceUnitInfo;
132 };
133 
134 
135 } // namespace iipr
136 
137 
138 #endif // !iipr_CLensCorrFindSupplierComp_included
139 
140 
virtual bool AddFeature(const imeas::INumericValue *featurePtr, bool *isFullPtr=NULL)
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.
void UpdateHoughSpace(const i2d::CVector2d &point1, const i2d::CVector2d &point2, double weight, const i2d::CVector2d &imageCenter, ialgo::CHoughSpace2d &space) const
Standard implementation of interface iinsp::ISupplier with preparation for component implementation...
bool CalculateCalibrationFactors(const AllCorrectionInfos &allCorrectionInfos, bool searchCenterFlag, const icalib::CSimpleLensCorrection &inputCorrection, icalib::CSimpleLensCorrection &result) const
i2d::CVector2d CalcHoughPos(const i2d::CVector2d &point1, const i2d::CVector2d &point2, const i2d::CVector2d &imageCenter, const istd::CIndex2d &spaceSize) const
Represents simple correction of image distortion by lenses.
Describe additional meta information for set of numeric values.
iinsp::TSupplierCompWrap< icalib::CSimpleLensCorrection > BaseClass
void AddCorrectPointsMessage(const AllCorrectionInfos &allCorrectionInfos, const icalib::CSimpleLensCorrection &inputCorrection, const i2d::CVector2d &imageCenter) const
Allow to extract some features from the image.
General parameter set containing list of numeric values.
Definition: INumericValue.h:20
#define NULL
virtual int ProduceObject(ProductType &result) const
Produce single object.
virtual const i2d::ICalibration2d * GetCalibration() const
Common interface for a features container consuming feature objects.
bool CalculateCalibration(const iimg::IBitmap &image, icalib::CSimpleLensCorrection &result) const
Base interface for suppliers providing calculating of objects on demand ("pull data" model)...
Definition: ISupplier.h:22
i2d::CLine2d CalcCorrespondingLine(const i2d::CVector2d &houghPos, const i2d::CVector2d &imageCenter, const istd::CIndex2d &spaceSize) const
QList< CorrectionLineInfo > AllCorrectionInfos
Simple implementation of imeas::INumericConstraints interface.
Hough space used for 2d Hough transformations.
Definition: CHoughSpace2d.h:27

© 2007-2017 Witold Gantzke and Kirill Lepskiy