CColorPatternComparatorComp.h
Go to the documentation of this file.
1 #ifndef iipr_CColorPatternComparatorComp_included
2 #define iipr_CColorPatternComparatorComp_included
3 
4 
5 // ACF includes
7 #include <icmm/CHsv.h>
11 #include <iipr/IFeaturesProvider.h>
16 
17 
18 namespace iipr
19 {
20 
21 
30  public iinsp::TSupplierCompWrap<imeas::CSimpleNumericValue>,
31  virtual public iipr::IFeaturesProvider,
32  virtual public istd::IInformationProvider,
34 {
35 public:
37 
38  I_BEGIN_COMPONENT(CColorPatternComparatorComp);
39  I_REGISTER_INTERFACE(iipr::IFeaturesProvider);
40  I_REGISTER_INTERFACE(istd::IInformationProvider);
41  I_REGISTER_INTERFACE(imeas::IDataSequenceProvider);
42  I_ASSIGN(m_patternCompareThresholdParamIdAttrPtr, "PatternCompareThresholdParamId", "ID of the threshold parameter for pattern comparison", true, "PatternCompareThresholdParamId");
43  I_ASSIGN(m_workingPatternProviderCompPtr, "WorkingPatternProvider", "Provider of the working pattern to be compared with the taught one", true, "WorkingPatternProvider");
44  I_ASSIGN_TO(m_workingPatternProviderModelCompPtr, m_workingPatternProviderCompPtr, true);
45  I_ASSIGN_TO(m_workingPatternSupplierCompPtr, m_workingPatternProviderCompPtr, true);
46  I_ASSIGN(m_taughtPatternProviderCompPtr, "TaughtPatternProvider", "Provider of the learned pattern", true, "TaughtPatternProvider");
47  I_ASSIGN_TO(m_taughtPatternProviderModelCompPtr, m_taughtPatternProviderCompPtr, false);
48  I_ASSIGN_TO(m_taughtPatternSupplierCompPtr, m_taughtPatternProviderCompPtr, false);
49  I_ASSIGN(m_dataStatisticsProcessorCompPtr, "DataStatisticsProcessor", "Processor used for calculation of the histogram statistics", true, "DataStatisticsProcessor");
50  I_ASSIGN(m_defaultSourceAttrPtr, "DefaultSource", "Default source of information", true, "Color Check");
51  I_END_COMPONENT;
52 
54 
55  // reimplemented (iipr::IFeaturesProvider)
56  virtual int GetFeaturesCount() const;
57  virtual const imeas::INumericValue& GetFeature(int index) const;
58 
59  // reimplemented (istd::IInformationProvider)
60  virtual QDateTime GetInformationTimeStamp() const;
61  virtual InformationCategory GetInformationCategory() const;
62  virtual int GetInformationId() const;
63  virtual QString GetInformationDescription() const;
64  virtual QString GetInformationSource() const;
65  virtual int GetInformationFlags() const;
66 
67 protected:
68  virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet);
69 
70  // reimplemented (iinsp::TSupplierCompWrap)
71  virtual int ProduceObject(ProductType& result) const;
72 
73  // reimplemented (icomp::CComponentBase)
74  virtual void OnComponentCreated();
75  virtual void OnComponentDestroyed();
76 
77 private:
78  bool GetHsvColorValue(const imeas::IDataSequenceStatistics& statistics, icmm::CHsv& hsv) const;
79 
80 private:
81  I_ATTR(QByteArray, m_patternCompareThresholdParamIdAttrPtr);
82  I_REF(imeas::IDataSequenceProvider, m_workingPatternProviderCompPtr);
83  I_REF(imod::IModel, m_workingPatternProviderModelCompPtr);
84  I_REF(iinsp::ISupplier, m_workingPatternSupplierCompPtr);
85 
86  I_REF(imeas::IDataSequenceProvider, m_taughtPatternProviderCompPtr);
87  I_REF(imod::IModel, m_taughtPatternProviderModelCompPtr);
88  I_REF(iinsp::ISupplier, m_taughtPatternSupplierCompPtr);
89 
90  I_REF(imeas::IDataSequenceStatisticsProcessor, m_dataStatisticsProcessorCompPtr);
91 
92  I_ATTR(QString, m_defaultSourceAttrPtr);
93 
94  mutable QDateTime m_resultTimeStamp;
95 
96  mutable bool m_isColorPatternMatched;
97 
98  mutable imeas::CDataSequenceStatistics m_taughtStatisticsCached;
99 };
100 
101 
102 } // namespace iipr
103 
104 
105 #endif // !iipr_CColorPatternComparatorComp_included
virtual int GetFeaturesCount() const
Get number of stored features.
Color comparator based on histogram statistics.
virtual int GetInformationFlags() const
virtual const imeas::INumericValue & GetFeature(int index) const
Get access to single feature.
Standard implementation of interface iinsp::ISupplier with preparation for component implementation...
virtual QDateTime GetInformationTimeStamp() const
Container allowing access to features.
virtual int ProduceObject(ProductType &result) const
Produce single object.
Simple data sequence provider.
Basic implementation of imeas::INumericValue interface.
virtual int GetInformationId() const
virtual QString GetInformationSource() const
General parameter set containing list of numeric values.
Definition: INumericValue.h:20
virtual QString GetInformationDescription() const
Base interface for suppliers providing calculating of objects on demand ("pull data" model)...
Definition: ISupplier.h:22
iinsp::TSupplierCompWrap< imeas::CSimpleNumericValue > BaseClass
virtual InformationCategory GetInformationCategory() const
Common interaface for data sequence statistics.
Processor interface for statistics calculation of a data sequence.
virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet)

© 2007-2017 Witold Gantzke and Kirill Lepskiy