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 
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 
49  // reimplemented (iproc::IProcessor)
50  virtual int DoProcessing(
51  const iprm::IParamsSet* paramsPtr,
52  const istd::IPolymorphic* inputPtr,
53  istd::IChangeable* outputPtr,
54  ibase::IProgressManager* progressManagerPtr = NULL);
55 
56 protected:
57  struct Point
58  {
59  double weight;
61 
63  :weight(0.0),
64  position(0, 0)
65  {
66  }
67  };
68 
69  struct CaliperLine
70  {
72  };
73 
74  typedef QVector<CaliperLine> CaliperLines;
75 
77  const istd::IChangeable& aoiObject,
78  const iprm::IParamsSet& params,
79  const iimg::IBitmap& image,
80  CaliperLines& rays,
81  i2d::CLine2d& projectionLine,
82  i2d::CVector2d& center);
83 
84  bool CalculateCaliper(
85  const iprm::IParamsSet& params,
86  iipr::ICaliperParams& workingCaliperParams,
87  ICaliperParams::DirectionMode caliperDirectionMode,
88  const iimg::IBitmap& image,
89  CaliperLine& ray) const;
90 
91  void SetCaliperResults(
92  const iprm::IParamsSet& params,
93  const imeas::INumericValueProvider& container,
94  ICaliperParams::DirectionMode caliperDirectionMode,
95  CaliperLine& ray) const;
96 
97 private:
98  I_REF(iproc::IProcessor, m_slaveProcessorCompPtr);
99  I_REF(iipr::IFeatureToImageMapper, m_featuresMapperCompPtr);
100  I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
101  I_ATTR(QByteArray, m_slaveLineIdAttrPtr);
102  I_ATTR(QByteArray, m_slaveCaliperParamsIdAttrPtr);
103 };
104 
105 
106 } // namespace iipr
107 
108 
109 #endif // !iipr_CEdgeDistanceProcessorComp_included
110 
111 
void SetCaliperResults(const iprm::IParamsSet &params, const imeas::INumericValueProvider &container, ICaliperParams::DirectionMode caliperDirectionMode, CaliperLine &ray) const
Wrapper of iproc::IProcessor for simple synchrone processor implementations.
Interface allowing mapping of extracted features to native coordinate systems.
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.
Provide access to the list of the numeric values.
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 assynchrone processors with "push data" model.
Definition: IProcessor.h:24
virtual int DoExtractFeatures(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, IFeaturesConsumer &results)
DirectionMode
Describe mode of search direction.

© 2007-2011 Witold Gantzke and Kirill Lepskiy