CEdgeDistanceProcessorComp.h
Go to the documentation of this file.
1 #ifndef iipr_CEdgeDistanceProcessorComp_included
2 #define iipr_CEdgeDistanceProcessorComp_included
3 
4 
5 // ACF includes
6 #include <i2d/CCircle.h>
7 #include <i2d/CAnnulus.h>
9 #include <icomp/CComponentBase.h>
11 
13 #include <iipr/IFeaturesProvider.h>
15 #include <iipr/ICaliperParams.h>
17 
18 
19 namespace iipr
20 {
21 
22 
27  public icomp::CComponentBase,
28  public iproc::TSyncProcessorWrap<IImageToFeatureProcessor>
29 {
30 public:
32 
33  I_BEGIN_COMPONENT(CEdgeDistanceProcessorComp);
34  I_REGISTER_INTERFACE(IImageToFeatureProcessor);
35  I_REGISTER_INTERFACE(iproc::IProcessor);
36  I_ASSIGN(m_slaveProcessorCompPtr, "SlaveEdgeProcessor", "Slave edge finder processor converting image to list of found edges", true, "SlaveEdgeProcessor");
37  I_ASSIGN(m_featuresMapperCompPtr, "FeaturesMapper", "Calculate position from caliper extracted features", true, "FeaturesMapper");
38  I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of area of interest in parameter set", true, "AoiParams");
39  I_ASSIGN(m_slaveLineIdAttrPtr, "SlaveLineId", "ID of line parameter added by this processor to parameter set for slave edge processor", true, "Line");
40  I_ASSIGN(m_slaveCaliperParamsIdAttrPtr, "SlaveCaliperParamsId", "ID of calipera parameters added by this processor to parameter set for slave edge processor", true, "Caliper");
41  I_END_COMPONENT;
42 
43  // reimplemented (iipr::IImageToFeatureProcessor)
44  virtual int DoExtractFeatures(
45  const iprm::IParamsSet* paramsPtr,
46  const iimg::IBitmap& image,
47  IFeaturesConsumer& results,
48  ibase::IProgressManager* progressManagerPtr = NULL);
49 
50  // reimplemented (iproc::IProcessor)
51  virtual int DoProcessing(
52  const iprm::IParamsSet* paramsPtr,
53  const istd::IPolymorphic* inputPtr,
54  istd::IChangeable* outputPtr,
55  ibase::IProgressManager* progressManagerPtr = NULL);
56 
57 protected:
58  struct Point
59  {
60  double weight;
62 
64  :weight(0.0),
65  position(0, 0)
66  {
67  }
68  };
69 
70  struct CaliperLine
71  {
73  };
74 
75  typedef std::vector<CaliperLine> CaliperLines;
76 
78  const istd::IChangeable& aoiObject,
79  const iprm::IParamsSet& params,
80  const iimg::IBitmap& image,
81  CaliperLines& rays,
82  i2d::CLine2d& projectionLine,
83  i2d::CVector2d& center);
84 
85  bool CalculateCaliper(
86  const iprm::IParamsSet& params,
87  iipr::ICaliperParams& workingCaliperParams,
88  ICaliperParams::DirectionMode caliperDirectionMode,
89  const iimg::IBitmap& image,
90  CaliperLine& ray) const;
91 
92  void SetCaliperResults(
93  const iprm::IParamsSet& params,
94  const IFeaturesProvider& container,
95  ICaliperParams::DirectionMode caliperDirectionMode,
96  CaliperLine& ray) const;
97 
98 private:
99  I_REF(iproc::IProcessor, m_slaveProcessorCompPtr);
100  I_REF(iipr::IFeatureToImageMapper, m_featuresMapperCompPtr);
101  I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
102  I_ATTR(QByteArray, m_slaveLineIdAttrPtr);
103  I_ATTR(QByteArray, m_slaveCaliperParamsIdAttrPtr);
104 };
105 
106 
107 } // namespace iipr
108 
109 
110 #endif // !iipr_CEdgeDistanceProcessorComp_included
111 
112 
Wrapper of iproc::IProcessor for simple synchrone processor implementations.
virtual int DoExtractFeatures(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, IFeaturesConsumer &results, ibase::IProgressManager *progressManagerPtr=NULL)
Interface allowing mapping of extracted features to native coordinate systems.
Container allowing access to features.
bool CalculateCaliperLines(const istd::IChangeable &aoiObject, const iprm::IParamsSet &params, const iimg::IBitmap &image, CaliperLines &rays, i2d::CLine2d &projectionLine, i2d::CVector2d &center)
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
Allow to extract some features from the image.
Cliper based distance calculation.
bool CalculateCaliper(const iprm::IParamsSet &params, iipr::ICaliperParams &workingCaliperParams, ICaliperParams::DirectionMode caliperDirectionMode, const iimg::IBitmap &image, CaliperLine &ray) const
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 SetCaliperResults(const iprm::IParamsSet &params, const IFeaturesProvider &container, ICaliperParams::DirectionMode caliperDirectionMode, CaliperLine &ray) const
DirectionMode
Describe mode of search direction.

© 2007-2017 Witold Gantzke and Kirill Lepskiy