CHoughLineFromPosFinderComp.h
Go to the documentation of this file.
1 #ifndef iipr_CHoughLineFromPosFinderComp_included
2 #define iipr_CHoughLineFromPosFinderComp_included
3 
4 
5 // ACF includes
6 #include <icomp/CComponentBase.h>
8 #include <ilog/TLoggerCompWrap.h>
9 #include <i2d/CLine2d.h>
10 #include <i2d/CPolypoint.h>
11 
12 // ACF-Solutions includes
16 #include <ialgo/CHoughSpace2d.h>
18 
19 
20 namespace iipr
21 {
22 
23 
30  public iproc::TSyncProcessorWrap<IFeatureToFeatureProcessor>
31 {
32 public:
33  typedef QList<i2d::CLine2d> Lines;
34 
36 
37  I_BEGIN_COMPONENT(CHoughLineFromPosFinderComp);
38  I_REGISTER_INTERFACE(iproc::IProcessor);
39  I_REGISTER_INTERFACE(IFeatureToFeatureProcessor);
40  I_ASSIGN(m_defaultAngleResAttrPtr, "DefaultAngleResulution", "Resolution of angle grid", true, 360);
41  I_ASSIGN(m_defaultRadiusResAttrPtr, "DefaultRadiusResulution", "Resolution of radius grid", true, 360);
42  I_ASSIGN(m_maxLinesParamIdAttrPtr, "MaxLinesParamId", "ID of max lines parameter in parameter set (imeas::INumericValue)", true, "MaxLines");
43  I_ASSIGN(m_defaultMaxLinesParamCompPtr, "DefaultMaxLinesParam", "Default value of parameter controlling number of maximal found lines", true, "DefaultMaxLinesParam");
44  I_ASSIGN(m_directionParamIdAttrPtr, "DirectionParamId", "ID of direction parameter in parameter set (i2d::IObject2d - line or position)", true, "Direction");
45  I_ASSIGN(m_defaultDirectionParamCompPtr, "DefaultDirectionParam", "Default value of parameter controlling direction", true, "DefaultDirectionParam");
46  I_ASSIGN(m_defaultSmoothKernelAttrPtr, "DefaultSpaceSmoothKernel", "Size of kernel will be used to smooth hough space", true, 10);
47  I_ASSIGN(m_resultConsumerCompPtr, "ResultConsumer", "Consumer of result messages with geometrical layout", false, "ResultConsumer");
48  I_ASSIGN(m_tempConsumerCompPtr, "TempConsumer", "Consumer of temporary result messages with geometrical layout", false, "TempConsumer");
49  I_END_COMPONENT;
50 
51  enum MessageId
52  {
53  FOUND_LINE = 0x934d750,
55  };
56 
57  // reimplemented (iipr::IFeatureToFeatureProcessor)
58  virtual int DoConvertFeatures(
59  const iprm::IParamsSet* paramsPtr,
60  const IFeaturesProvider& container,
61  IFeaturesConsumer& results);
62 
63  // reimplemented (iproc::IProcessor)
64  virtual int DoProcessing(
65  const iprm::IParamsSet* paramsPtr,
66  const istd::IPolymorphic* inputPtr,
67  istd::IChangeable* outputPtr,
68  ibase::IProgressManager* progressManagerPtr = NULL);
69 
70 protected:
71  virtual int FindLines(
72  const iprm::IParamsSet* paramsPtr,
73  int maxLines,
74  const i2d::CPolypoint& points,
75  IFeaturesConsumer& results);
76 
77  bool CreateHoughSpace();
78  i2d::CVector2d CalcHoughPos(const i2d::CVector2d& point1, const i2d::CVector2d& point2) const;
79  i2d::CLine2d CalcCorrespondingLine(const i2d::CVector2d& houghPos) const;
80  void UpdateHoughSpace(const i2d::CVector2d& point1, const i2d::CVector2d& point2);
81 
82  // reimplemented (icomp::CComponentBase)
83  virtual void OnComponentCreated();
84 
85 private:
86  typedef TWeightedFeatureWrap<i2d::CLine2d> LineFeature;
87 
88  I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
89  I_ATTR(int, m_defaultAngleResAttrPtr);
90  I_ATTR(int, m_defaultRadiusResAttrPtr);
91  I_ATTR(QByteArray, m_maxLinesParamIdAttrPtr);
92  I_REF(imeas::INumericValue, m_defaultMaxLinesParamCompPtr);
93  I_ATTR(QByteArray, m_directionParamIdAttrPtr);
94  I_REF(i2d::IObject2d, m_defaultDirectionParamCompPtr);
95  I_ATTR(int, m_defaultSmoothKernelAttrPtr);
96  I_REF(ilog::IMessageConsumer, m_resultConsumerCompPtr);
97  I_REF(ilog::IMessageConsumer, m_tempConsumerCompPtr);
98 
99  ialgo::CHoughSpace2d m_houghSpace;
100  i2d::CVector2d m_direction;
101  double m_directionAngleTolerance;
102 };
103 
104 
105 } // namespace iipr
106 
107 
108 #endif // !iipr_CHoughLineFromPosFinderComp_included
109 
110 
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
Wrapper of iproc::IProcessor for simple synchrone processor implementations.
i2d::CLine2d CalcCorrespondingLine(const i2d::CVector2d &houghPos) const
Container allowing access to features.
virtual int FindLines(const iprm::IParamsSet *paramsPtr, int maxLines, const i2d::CPolypoint &points, IFeaturesConsumer &results)
i2d::CVector2d CalcHoughPos(const i2d::CVector2d &point1, const i2d::CVector2d &point2) const
Allow to extract some features from another one.
General parameter set containing list of numeric values.
Definition: INumericValue.h:20
Finder using Hough transformation to find the lines from the point cloud.
Common interface for a features container consuming feature objects.
Interface for all synchrone and asynchrone processors with "push data" model.
Definition: IProcessor.h:24
void UpdateHoughSpace(const i2d::CVector2d &point1, const i2d::CVector2d &point2)
virtual int DoConvertFeatures(const iprm::IParamsSet *paramsPtr, const IFeaturesProvider &container, IFeaturesConsumer &results)
Hough space used for 2d Hough transformations.
Definition: CHoughSpace2d.h:27

© 2007-2017 Witold Gantzke and Kirill Lepskiy