CHoughLineFinderComp.h
Go to the documentation of this file.
1 #ifndef iipr_CHoughLineFinderComp_included
2 #define iipr_CHoughLineFinderComp_included
3 
4 
5 // ACF includes
6 #include <icomp/CComponentBase.h>
8 #include <ilog/TLoggerCompWrap.h>
9 #include <i2d/CLine2d.h>
10 
11 // ACF-Solutions includes
15 #include <ialgo/CHoughSpace2d.h>
16 
17 
18 namespace iipr
19 {
20 
21 
27  public iproc::TSyncProcessorWrap<IImageToFeatureProcessor>
28 {
29 public:
31 
32  I_BEGIN_COMPONENT(CHoughLineFinderComp);
33  I_REGISTER_INTERFACE(iproc::IProcessor);
34  I_REGISTER_INTERFACE(IImageToFeatureProcessor);
35  I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of AOI in parameter set", false, "Aoi");
36  I_ASSIGN(m_defaultAngleResAttrPtr, "DefaultAngleResulution", "Resolution of angle grid", true, 360);
37  I_ASSIGN(m_defaultRadiusResAttrPtr, "DefaultRadiusResulution", "Resolution of radius grid", true, 200);
38  I_ASSIGN(m_defaultMaxLinesAttrPtr, "DefaultMaxLines", "Number of maximal found lines", true, 100);
39  I_ASSIGN(m_defaultSmoothKernelAttrPtr, "DefaultSpaceSmoothKernel", "Size of kernel will be used to smooth hough space", true, 10);
40  I_ASSIGN(m_defaultMinEdgeStrengthAttrPtr, "DefaultMinEdgeStrength", "Minimal strength of edge to be considered", true, 0.01);
41  I_ASSIGN(m_defaultAoiCompPtr, "DefaultAoi", "Area of interest used if not specified in parameters", false, "DefaultAoi");
42  I_ASSIGN(m_resultConsumerCompPtr, "ResultConsumer", "Consumer of result messages with geometrical layout", false, "ResultConsumer");
43  I_ASSIGN(m_tempConsumerCompPtr, "TempConsumer", "Consumer of temporary result messages with geometrical layout", false, "TempConsumer");
44  I_END_COMPONENT;
45 
46  enum MessageId
47  {
48  FOUND_LINE = 0x934d740,
50  };
51 
52  // reimplemented (iipr::IImageToFeatureProcessor)
53  virtual int DoExtractFeatures(
54  const iprm::IParamsSet* paramsPtr,
55  const iimg::IBitmap& image,
56  IFeaturesConsumer& results,
57  ibase::IProgressManager* progressManagerPtr = NULL);
58 
59  // reimplemented (iproc::IProcessor)
60  virtual int DoProcessing(
61  const iprm::IParamsSet* paramsPtr,
62  const istd::IPolymorphic* inputPtr,
63  istd::IChangeable* outputPtr,
64  ibase::IProgressManager* progressManagerPtr = NULL);
65 
66 protected:
67  bool CreateHoughSpace();
68  void UpdateHoughSpace(const i2d::CVector2d& position, const i2d::CVector2d& direction, double radiusOffset);
69 
70  // reimplemented (icomp::CComponentBase)
71  virtual void OnComponentCreated();
72 
73 private:
74  typedef TWeightedFeatureWrap<i2d::CLine2d> LineFeature;
75 
76  I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
77  I_ATTR(int, m_defaultAngleResAttrPtr);
78  I_ATTR(int, m_defaultRadiusResAttrPtr);
79  I_ATTR(int, m_defaultMaxLinesAttrPtr);
80  I_ATTR(int, m_defaultSmoothKernelAttrPtr);
81  I_ATTR(double, m_defaultMinEdgeStrengthAttrPtr);
82  I_REF(i2d::IObject2d, m_defaultAoiCompPtr);
83  I_REF(ilog::IMessageConsumer, m_resultConsumerCompPtr);
84  I_REF(ilog::IMessageConsumer, m_tempConsumerCompPtr);
85 
86  ialgo::CHoughSpace2d m_houghSpace;
87 
88  typedef QVector<i2d::CVector2d> AngleVectors;
89  AngleVectors m_angleVectors;
90 };
91 
92 
93 } // namespace iipr
94 
95 
96 #endif // !iipr_CHoughLineFinderComp_included
97 
98 
virtual int DoExtractFeatures(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, IFeaturesConsumer &results, ibase::IProgressManager *progressManagerPtr=NULL)
Wrapper of iproc::IProcessor for simple synchrone processor implementations.
ilog::CLoggerComponentBase BaseClass
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
void UpdateHoughSpace(const i2d::CVector2d &position, const i2d::CVector2d &direction, double radiusOffset)
Allow to extract some features from the image.
Common interface for a features container consuming feature objects.
Interface for all synchrone and asynchrone processors with "push data" model.
Definition: IProcessor.h:24
Processor using Hough transformation to find the lines on the image.
virtual void OnComponentCreated()
Hough space used for 2d Hough transformations.
Definition: CHoughSpace2d.h:27

© 2007-2017 Witold Gantzke and Kirill Lepskiy