CBlobProcessorCompBase.h
Go to the documentation of this file.
1 #ifndef iblob_CBlobProcessorCompBase_included
2 #define iblob_CBlobProcessorCompBase_included
3 
4 
5 // ACF includes
6 #include <iprm/COptionsManager.h>
8 
9 // ACF-Solutions includes
12 
13 
14 namespace iblob
15 {
16 
17 
18 class CBlobProcessorCompBase: public iproc::TSyncProcessorCompBase<iipr::IImageToFeatureProcessor>
19 {
20 public:
22 
23  I_BEGIN_BASE_COMPONENT(CBlobProcessorCompBase);
24  I_REGISTER_SUBELEMENT(FilterFeatureList);
25  I_REGISTER_SUBELEMENT_INTERFACE(FilterFeatureList, iprm::IOptionsList, ExtractFilterFeatureList);
26  I_REGISTER_SUBELEMENT_INTERFACE(FilterFeatureList, istd::IChangeable, ExtractFilterFeatureList);
27  I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of area of interest in parameter set", false, "AoiParams");
28  I_ASSIGN(m_defaultAoiCompPtr, "DefaultAoi", "Area of interest used if not specified in parameters", false, "DefaultAoi");
29  I_ASSIGN(m_filterParamsIdAttrPtr, "FilterParamsId", "ID of blob filter parameters in the parameter set (iblob::IBlobFilterParams)", false, "FilterParams");
30  I_ASSIGN(m_defaultFilterParamsCompPtr, "DefaultFilterParams", "Default blob filter parameters", false, "DefaultFilterParams");
31  I_END_COMPONENT;
32 
33  // reimplemented (iipr::IImageToFeatureProcessor)
34  virtual int DoExtractFeatures(
35  const iprm::IParamsSet* paramsPtr,
36  const iimg::IBitmap& image,
37  iipr::IFeaturesConsumer& results,
38  ibase::IProgressManager* progressManagerPtr = NULL);
39 
40  // reimplemented (iproc::IProcessor)
41  virtual int DoProcessing(
42  const iprm::IParamsSet* paramsPtr,
43  const istd::IPolymorphic* inputPtr,
44  istd::IChangeable* outputPtr,
45  ibase::IProgressManager* progressManagerPtr = NULL);
46 
47 protected:
48  static bool IsBlobAcceptedByFilter(const iblob::IBlobFilterParams& filterParams, double area, double perimeter, double circularity);
49 
50  // abstract methods
51  virtual bool CalculateBlobs(
52  const iprm::IParamsSet* paramsPtr,
53  const iblob::IBlobFilterParams* filterParamsPtr,
54  const i2d::IObject2d* aoiPtr,
55  const iimg::IBitmap& image,
56  iipr::IFeaturesConsumer& result) = 0;
57 
58 private:
59  class FilterFeatureList: public iprm::COptionsManager
60  {
61  public:
62  FilterFeatureList();
63  };
64 
65  static bool IsValueAcceptedByFilter(const iblob::IBlobFilterParams::Filter& filter, double value);
66 
67  // static template methods for sub-element access
68  template <class InterfaceType>
69  static InterfaceType* ExtractFilterFeatureList(CBlobProcessorCompBase& component)
70  {
71  return &component.m_filterFeatureList;
72  }
73 
74 private:
75  I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
76  I_REF(i2d::IObject2d, m_defaultAoiCompPtr);
77 
78  I_ATTR(QByteArray, m_filterParamsIdAttrPtr);
79  I_REF(iblob::IBlobFilterParams, m_defaultFilterParamsCompPtr);
80 
81  FilterFeatureList m_filterFeatureList;
82 };
83 
84 
85 } // namespace iblob
86 
87 
88 #endif // !iblob_CBlobProcessorCompBase_included
89 
90 
Simple definition macro for a synchronous processor.
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
Do synchronized processing.
virtual bool CalculateBlobs(const iprm::IParamsSet *paramsPtr, const iblob::IBlobFilterParams *filterParamsPtr, const i2d::IObject2d *aoiPtr, const iimg::IBitmap &image, iipr::IFeaturesConsumer &result)=0
iproc::TSyncProcessorCompBase< iipr::IImageToFeatureProcessor > BaseClass
virtual int DoExtractFeatures(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, iipr::IFeaturesConsumer &results, ibase::IProgressManager *progressManagerPtr=NULL)
Specialization of processing interface for extraction of features from image.
static bool IsBlobAcceptedByFilter(const iblob::IBlobFilterParams &filterParams, double area, double perimeter, double circularity)
Common interface for a features container consuming feature objects.
Interface for parameters of the blob filtering.

© 2007-2017 Witold Gantzke and Kirill Lepskiy