ICF 3.1.1.10
Technical documentation of ICF Libraries
CBlobProcessorCompBase.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 iblob_CBlobProcessorCompBase_included
7#define iblob_CBlobProcessorCompBase_included
8
9
10// ICF includes
15
16
17namespace iipr
18{
19
20
21class CBlobProcessorCompBase: public iproc::TSyncProcessorCompBase<iipr::IImageToFeatureProcessor>
22{
23public:
25
26 I_BEGIN_BASE_COMPONENT(CBlobProcessorCompBase);
27 I_REGISTER_SUBELEMENT(FilterFeatureList);
28 I_REGISTER_SUBELEMENT_INTERFACE(FilterFeatureList, iprm::IOptionsList, ExtractFilterFeatureList);
29 I_REGISTER_SUBELEMENT_INTERFACE(FilterFeatureList, istd::IChangeable, ExtractFilterFeatureList);
30 I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of area of interest in parameter set", false, "AoiParams");
31 I_ASSIGN(m_defaultAoiCompPtr, "DefaultAoi", "Area of interest used if not specified in parameters", false, "DefaultAoi");
32 I_ASSIGN(m_filterParamsIdAttrPtr, "FilterParamsId", "ID of blob filter parameters in the parameter set (iipr::IBlobFilterParams)", false, "FilterParams");
33 I_ASSIGN(m_defaultFilterParamsCompPtr, "DefaultFilterParams", "Default blob filter parameters", false, "DefaultFilterParams");
34 I_END_COMPONENT;
35
36 // reimplemented (iipr::IImageToFeatureProcessor)
38 const iprm::IParamsSet* paramsPtr,
39 const iimg::IBitmap& image,
41 iproc::IProgressManager* progressManagerPtr = nullptr) override;
42
43 // reimplemented (iproc::IProcessor)
45 const iprm::IParamsSet* paramsPtr,
46 const istd::IPolymorphic* inputPtr,
47 istd::IChangeable* outputPtr,
48 bool allowAsync = false,
49 iproc::IProgressManager* progressManagerPtr = nullptr) override;
50
51protected:
52 static bool IsBlobAcceptedByFilter(const iipr::IBlobFilterParams& filterParams, double area, double perimeter, double circularity);
53
54 // abstract methods
55 virtual bool CalculateBlobs(
56 const iprm::IParamsSet* paramsPtr,
57 const iipr::IBlobFilterParams* filterParamsPtr,
58 const i2d::IObject2d* aoiPtr,
59 const iimg::IBitmap& image,
60 iipr::IFeaturesConsumer& result) = 0;
61
62private:
63 class FilterFeatureList: public iprm::COptionsManager
64 {
65 public:
66 FilterFeatureList();
67 };
68
69 static bool IsValueAcceptedByFilter(const iipr::IBlobFilterParams::Filter& filter, double value);
70
71 // static template methods for sub-element access
72 template <class InterfaceType>
73 static InterfaceType* ExtractFilterFeatureList(CBlobProcessorCompBase& component)
74 {
75 return &component.m_filterFeatureList;
76 }
77
78private:
79 I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
80 I_REF(i2d::IObject2d, m_defaultAoiCompPtr);
81
82 I_ATTR(QByteArray, m_filterParamsIdAttrPtr);
83 I_REF(iipr::IBlobFilterParams, m_defaultFilterParamsCompPtr);
84
85 FilterFeatureList m_filterFeatureList;
86};
87
88
89} // namespace iipr
90
91
92#endif // !iblob_CBlobProcessorCompBase_included
93
94
Common interface for describing the 2D-objects.
Definition IObject2d.h:30
Definition of single plane bitmap.
Definition IBitmap.h:24
iproc::TSyncProcessorCompBase< iipr::IImageToFeatureProcessor > BaseClass
virtual iproc::CTaskState DoExtractFeatures(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, iipr::IFeaturesConsumer &results, iproc::IProgressManager *progressManagerPtr=nullptr) override
Specialization of processing interface for extraction of features from image.
virtual bool CalculateBlobs(const iprm::IParamsSet *paramsPtr, const iipr::IBlobFilterParams *filterParamsPtr, const i2d::IObject2d *aoiPtr, const iimg::IBitmap &image, iipr::IFeaturesConsumer &result)=0
static bool IsBlobAcceptedByFilter(const iipr::IBlobFilterParams &filterParams, double area, double perimeter, double circularity)
virtual iproc::CTaskState DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, bool allowAsync=false, iproc::IProgressManager *progressManagerPtr=nullptr) override
Do synchronized processing.
Interface for parameters of the blob filtering.
Common interface for a features container consuming feature objects.
Implementation of a simple options manager.
Constraints of selection from set of possibilities.
Set of general parameters.
Definition IParamsSet.h:29
Represent state of asynchronous operation.
Definition CTaskState.h:28
Consume information about progress of some process.
Simple definition macro for a synchronous processor.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy