ICF 3.0.5.47
Technical documentation of ICF Libraries
CCheckboardCalibSupplierComp.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_CCheckboardCalibSupplierComp_included
7#define iipr_CCheckboardCalibSupplierComp_included
8
9
10// ICF includes
14#include <i2d/CLine2d.h>
16#include <imeas/INumericValue.h>
18#include <iproc/IProcessor.h>
22
23
24namespace iipr
25{
26
27
32 public iinsp::TSupplierCompWrap< icalib::CPerspectiveCalibration2d >,
33 virtual public i2d::ICalibration2dProvider
34{
35public:
37
38 I_BEGIN_COMPONENT(CCheckboardCalibSupplierComp);
39 I_REGISTER_INTERFACE(i2d::ICalibration2dProvider);
40 I_REGISTER_SUBELEMENT(CheckboardParamContraints);
41 I_REGISTER_SUBELEMENT_INTERFACE(CheckboardParamContraints, imeas::INumericConstraints, ExtractCheckboardParamContraints);
42 I_REGISTER_SUBELEMENT_INTERFACE(CheckboardParamContraints, istd::IChangeable, ExtractCheckboardParamContraints);
43 I_ASSIGN(m_bitmapProviderCompPtr, "BitmapProvider", "Provide input image", true, "BitmapProvider");
44 I_ASSIGN_TO(m_bitmapProviderModelCompPtr, m_bitmapProviderCompPtr, false);
45 I_ASSIGN_TO(m_bitmapProviderSupplierCompPtr, m_bitmapProviderCompPtr, false);
46 I_ASSIGN(m_lineFinderCompPtr, "LineFinder", "Finder of lines on image", true, "LineFinder");
47 I_ASSIGN(m_checkboardParamsId, "CheckboardParamsId", "ID of checkboard parameters in parameter set (type imeas::INumericValue):\n1\t1. grid size\n\t2. cell size in logical units", false, "CheckboardParams");
48 I_ASSIGN(m_defaultCheckboardParamsCompPtr, "DefaultCheckboardParams", "Default parameter controlling size of single checkboard cell when it is not defined in parameter set:\n1\t1. grid size\n\t2. cell size in logical units", false, "DefaultCheckboardParams");
49 I_ASSIGN(m_axisXParamIdAttrPtr, "AxisXParamId", "ID of axis X template in parameter set (type i2d::CLine2d), it is used to coarse knowing direction of X axis", false, "AxisX");
50 I_ASSIGN(m_defaultAxisXParamCompPtr, "DefaultAxisXParam", "Default parameter controlling axis X template, it is used to coarse knowing direction of X axis", false, "DefaultAxisXParam");
51 I_ASSIGN(m_axisYParamIdAttrPtr, "AxisYParamId", "ID of axis Y template in parameter set (type i2d::CLine2d), it is used to coarse knowing direction of Y axis", false, "AxisY");
52 I_ASSIGN(m_defaultAxisYParamCompPtr, "DefaultAxisYParam", "Default parameter controlling axis Y template, it is used to coarse knowing direction of Y axis", false, "DefaultAxisYParam");
53 I_ASSIGN(m_distanceUnitInfoCompPtr, "DistanceUnitInfo", "Information about used distance units", false, "DistanceUnitInfo");
54 I_ASSIGN(m_defaultGridSizeAttrPtr, "DefaultGridSize", "Default size of grid if no checkboard parameters specified", true, 8);
55 I_ASSIGN(m_defaultCellSizeAttrPtr, "DefaultCellSize", "Default size of single cell (in logical units) if no checkboard parameters specified", true, 10);
56 I_END_COMPONENT;
57
59
60 // reimplemented (i2d::ICalibration2dProvider)
61 const i2d::ICalibration2d* GetCalibration() const override;
62
63protected:
64 struct LineInfo
65 {
66 double weight;
68 };
69
70 typedef QList<LineInfo> Lines;
71
73 {
74 public:
75 // reimplemented (iipr::IFeaturesConsumer)
76 void ResetFeatures() override;
77 bool AddFeature(const imeas::INumericValue* featurePtr, bool* isFullPtr = nullptr) override;
78
80 };
81
83 {
84 public:
86
87 // reimplemented (imeas::INumericConstraints)
88 const iprm::IOptionsList& GetValueListInfo() const override;
89 const imath::IUnitInfo* GetNumericValueUnitInfo(int index) const override;
90
91 protected:
92 // reimplemented (iprm::IOptionsList)
93 int GetOptionsFlags() const override;
94 int GetOptionsCount() const override;
95 QString GetOptionName(int index) const override;
96 QString GetOptionDescription(int index) const override;
97 QByteArray GetOptionId(int index) const override;
98 bool IsOptionEnabled(int index) const override;
99
100 private:
101 imath::CGeneralUnitInfo m_cellSizeUnit;
102 const CCheckboardCalibSupplierComp* m_parentPtr;
103 };
104
106
107 // reimplemented (iinsp::TSupplierCompWrap)
108 int ProduceObject(ProductType& result) const override;
109
110 // reimplemented (icomp::CComponentBase)
111 void OnComponentCreated() override;
112
113private:
114 I_REF(iimg::IBitmapProvider, m_bitmapProviderCompPtr);
115 I_REF(imod::IModel, m_bitmapProviderModelCompPtr);
116 I_REF(iinsp::ISupplier, m_bitmapProviderSupplierCompPtr);
117 I_REF(iipr::IImageToFeatureProcessor, m_lineFinderCompPtr);
118 I_ATTR(QByteArray, m_checkboardParamsId);
119 I_REF(imeas::INumericValue, m_defaultCheckboardParamsCompPtr);
120 I_ATTR(QByteArray, m_axisXParamIdAttrPtr);
121 I_REF(i2d::CLine2d, m_defaultAxisXParamCompPtr);
122 I_ATTR(QByteArray, m_axisYParamIdAttrPtr);
123 I_REF(i2d::CLine2d, m_defaultAxisYParamCompPtr);
124 I_REF(imath::IUnitInfo, m_distanceUnitInfoCompPtr);
125 I_ATTR(int, m_defaultGridSizeAttrPtr);
126 I_ATTR(double, m_defaultCellSizeAttrPtr);
127
128 // static template methods for subelement access
129 template <class InterfaceType>
130 static InterfaceType* ExtractCheckboardParamContraints(CCheckboardCalibSupplierComp& component)
131 {
132 return &component.m_checkboardParamContraints;
133 }
134
135 ChessboardParamsContraints m_checkboardParamContraints;
136
137 static imath::CFixedPointManip s_gridSizeValueManip;
138 static imath::CGeneralUnitInfo s_gridSizeUnit;
139};
140
141
142} // namespace iipr
143
144
145#endif // !iipr_CCheckboardCalibSupplierComp_included
146
147
Definition of a line in 2D-space.
Definition CLine2d.h:26
Common interface for an object, which delivers a 2D-calibration.
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.
const imath::IUnitInfo * GetNumericValueUnitInfo(int index) const override
Get range of possible numeric values for specified list index.
QByteArray GetOptionId(int index) const override
Get option ID.
QString GetOptionName(int index) const override
Get name of specified option.
int GetOptionsCount() const override
Get number of managed options.
int GetOptionsFlags() const override
Get constraints flags.
const iprm::IOptionsList & GetValueListInfo() const override
Get general information about the "content" of the numeric value.
ChessboardParamsContraints(const CCheckboardCalibSupplierComp *supplierPtr)
bool IsOptionEnabled(int index) const override
Return true if the option is enabled and can be selected.
QString GetOptionDescription(int index) const override
Get human readable description for a option with the index index.
void ResetFeatures() override
Remove all features from this container.
bool AddFeature(const imeas::INumericValue *featurePtr, bool *isFullPtr=nullptr) override
Add new feature to the set of features.
const i2d::ICalibration2d * GetCalibration() const override
Get access to transformation object, which transforms a local logical coordinate system to global one...
int ProduceObject(ProductType &result) const override
Produce single object.
iinsp::TSupplierCompWrap< icalib::CPerspectiveCalibration2d > BaseClass
bool CalculateCalibration(const iimg::IBitmap &image, icalib::CPerspectiveCalibration2d &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.
Common interface to get information about a measurement unit.
Definition IUnitInfo.h:27
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
Constraints of selection from set of possibilities.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy