CImageCropDecalibrateProcessorComp.h
Go to the documentation of this file.
1 #ifndef iipr_CImageCropDecalibrateProcessorComp_included
2 #define iipr_CImageCropDecalibrateProcessorComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QByteArray>
7 
8 // ACF includes
9 #include <iimg/IBitmap.h>
10 #include <i2d/CRectangle.h>
11 #include <iprm/COptionsManager.h>
12 
13 // ACF-Solutions includes
16 
17 
18 namespace iipr
19 {
20 
21 
26 {
27 public:
29 
30  I_BEGIN_COMPONENT(CImageCropDecalibrateProcessorComp);
31  I_REGISTER_INTERFACE(iproc::IProcessor);
32  I_REGISTER_SUBELEMENT(InterpolationModes);
33  I_REGISTER_SUBELEMENT_INTERFACE(InterpolationModes, iprm::IOptionsList, ExtractInterpolationModes);
34  I_REGISTER_SUBELEMENT_INTERFACE(InterpolationModes, istd::IChangeable, ExtractInterpolationModes);
35  I_REGISTER_SUBELEMENT(OrientationModes);
36  I_REGISTER_SUBELEMENT_INTERFACE(OrientationModes, iprm::IOptionsList, ExtractOrientationModes);
37  I_REGISTER_SUBELEMENT_INTERFACE(OrientationModes, istd::IChangeable, ExtractOrientationModes);
38  I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of area of interest in parameter set (i2d::CRectangle)", false, "AoiParams");
39  I_ASSIGN(m_defaultAoiCompPtr, "DefaultAoi", "Area of interest used if not specified in parameters", false, "DefaultAoi");
40  I_ASSIGN(m_interpolationModeParamIdAttrPtr, "InterpolationModeParamId", "ID of interpolation mode selection in parameter set (iprm::ISelectionParam)", false, "InterpolationMode");
41  I_ASSIGN(m_defaultInterpolationModeCompPtr, "DefaultInterpolationMode", "Interpolation mode selection used if not specified in parameters", false, "DefaultInterpolationMode");
42  I_ASSIGN(m_orientationModeParamIdAttrPtr, "OrientationModeParamId", "ID of orientation mode selection in parameter set (iprm::ISelectionParam)", false, "OrientationMode");
43  I_ASSIGN(m_defaultOrientationModeCompPtr, "DefaultOrientationMode", "Orientation mode selection used if not specified in parameters", false, "DefaultOrientationMode");
44  I_ASSIGN(m_cellSizeAttrPtr, "CellSize", "Size of single cell (inside of cell linear interpolation will be used)", true, 8);
45  I_END_COMPONENT;
46 
48  {
52  };
53 
55  {
58  };
59 
61 
62  static bool CropImage(
63  const i2d::CRectangle& sourceAoi,
64  int cellSize,
65  const iimg::IBitmap& inputBitmap,
66  iimg::IBitmap& outputBitmap,
67  int interpolationMode = IM_LINEAR,
68  int orientationMode = OM_SIMPLE,
69  ilog::IMessageConsumer* resultConsumerPtr = NULL);
70 
71  static bool CalcCalibration(
72  const i2d::CRectangle& sourceAoi,
73  icalib::CAffineCalibration2d& outputCalib,
74  int orientationMode = OM_SIMPLE);
75 
76  // reimplemented (iproc::IProcessor)
77  virtual int DoProcessing(
78  const iprm::IParamsSet* paramsPtr,
79  const istd::IPolymorphic* inputPtr,
80  istd::IChangeable* outputPtr,
81  ibase::IProgressManager* progressManagerPtr = NULL);
82 
83 protected:
84  static bool CalcOutputImageSize(
85  const i2d::CRectangle& sourceAoi,
86  istd::CIndex2d& result);
87 
88 private:
89  template <class InterfaceType>
90  static InterfaceType* ExtractInterpolationModes(CImageCropDecalibrateProcessorComp& component)
91  {
92  return &component.m_interpolationModes;
93  }
94 
95  template <class InterfaceType>
96  static InterfaceType* ExtractOrientationModes(CImageCropDecalibrateProcessorComp& component)
97  {
98  return &component.m_orientationModes;
99  }
100 
101  I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
102  I_REF(i2d::CRectangle, m_defaultAoiCompPtr);
103  I_ATTR(QByteArray, m_interpolationModeParamIdAttrPtr);
104  I_REF(iprm::ISelectionParam, m_defaultInterpolationModeCompPtr);
105  I_ATTR(QByteArray, m_orientationModeParamIdAttrPtr);
106  I_REF(iprm::ISelectionParam, m_defaultOrientationModeCompPtr);
107  I_ATTR(int, m_cellSizeAttrPtr);
108 
109  iprm::COptionsManager m_interpolationModes;
110  iprm::COptionsManager m_orientationModes;
111 };
112 
113 
114 } // namespace iipr
115 
116 
117 #endif // !iipr_CImageCropDecalibrateProcessorComp_included
118 
119 
static bool CalcOutputImageSize(const i2d::CRectangle &sourceAoi, istd::CIndex2d &result)
Simple definition macro for a synchronous processor.
Crop the image region and rectificate (de-calibrate) it.
static bool CropImage(const i2d::CRectangle &sourceAoi, int cellSize, const iimg::IBitmap &inputBitmap, iimg::IBitmap &outputBitmap, int interpolationMode=IM_LINEAR, int orientationMode=OM_SIMPLE, ilog::IMessageConsumer *resultConsumerPtr=NULL)
Definition of an affine transformation for 2D-spaces.
Interface for all synchrone and asynchrone processors with "push data" model.
Definition: IProcessor.h:24
static bool CalcCalibration(const i2d::CRectangle &sourceAoi, icalib::CAffineCalibration2d &outputCalib, int orientationMode=OM_SIMPLE)
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)

© 2007-2017 Witold Gantzke and Kirill Lepskiy