ICF 3.0.5.47
Technical documentation of ICF Libraries
CImageCropDecalibrateProcessorComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iipr_CImageCropDecalibrateProcessorComp_included
7#define iipr_CImageCropDecalibrateProcessorComp_included
8
9
10// Qt includes
11#include <QtCore/QByteArray>
12
13// ICF includes
14#include <iimg/IBitmap.h>
15#include <i2d/CRectangle.h>
19
20
21namespace iipr
22{
23
24
29{
30public:
32
33 I_BEGIN_COMPONENT(CImageCropDecalibrateProcessorComp);
34 I_REGISTER_INTERFACE(iproc::IProcessor);
35 I_REGISTER_SUBELEMENT(InterpolationModes);
36 I_REGISTER_SUBELEMENT_INTERFACE(InterpolationModes, iprm::IOptionsList, ExtractInterpolationModes);
37 I_REGISTER_SUBELEMENT_INTERFACE(InterpolationModes, istd::IChangeable, ExtractInterpolationModes);
38 I_REGISTER_SUBELEMENT(OrientationModes);
39 I_REGISTER_SUBELEMENT_INTERFACE(OrientationModes, iprm::IOptionsList, ExtractOrientationModes);
40 I_REGISTER_SUBELEMENT_INTERFACE(OrientationModes, istd::IChangeable, ExtractOrientationModes);
41 I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of area of interest in parameter set (i2d::CRectangle)", false, "AoiParams");
42 I_ASSIGN(m_defaultAoiCompPtr, "DefaultAoi", "Area of interest used if not specified in parameters", false, "DefaultAoi");
43 I_ASSIGN(m_interpolationModeParamIdAttrPtr, "InterpolationModeParamId", "ID of interpolation mode selection in parameter set (iprm::ISelectionParam)", false, "InterpolationMode");
44 I_ASSIGN(m_defaultInterpolationModeCompPtr, "DefaultInterpolationMode", "Interpolation mode selection used if not specified in parameters", false, "DefaultInterpolationMode");
45 I_ASSIGN(m_orientationModeParamIdAttrPtr, "OrientationModeParamId", "ID of orientation mode selection in parameter set (iprm::ISelectionParam)", false, "OrientationMode");
46 I_ASSIGN(m_defaultOrientationModeCompPtr, "DefaultOrientationMode", "Orientation mode selection used if not specified in parameters", false, "DefaultOrientationMode");
47 I_ASSIGN(m_cellSizeAttrPtr, "CellSize", "Size of single cell (inside of cell linear interpolation will be used)", true, 8);
48 I_END_COMPONENT;
49
56
62
64
65 static bool CropImage(
66 const i2d::CRectangle& sourceAoi,
67 int cellSize,
68 const iimg::IBitmap& inputBitmap,
69 iimg::IBitmap& outputBitmap,
70 istd::CIndex2d* outputImageSizePtr = nullptr,
71 int interpolationMode = IM_LINEAR,
72 int orientationMode = OM_SIMPLE,
73 ilog::IMessageConsumer* resultConsumerPtr = nullptr);
74
75 static bool CalcCalibration(
76 const i2d::CRectangle& sourceAoi,
78 istd::CIndex2d* outputImageSizePtr = nullptr,
79 int orientationMode = OM_SIMPLE);
80
81 // reimplemented (iproc::IProcessor)
83 const iprm::IParamsSet* paramsPtr,
84 const istd::IPolymorphic* inputPtr,
85 istd::IChangeable* outputPtr,
86 bool allowAsync = false,
87 iproc::IProgressManager* progressManagerPtr = nullptr) override;
88
89protected:
91 const i2d::CRectangle& sourceAoi,
92 istd::CIndex2d& result);
93
94private:
95 template <class InterfaceType>
96 static InterfaceType* ExtractInterpolationModes(CImageCropDecalibrateProcessorComp& component)
97 {
98 return &component.m_interpolationModes;
99 }
100
101 template <class InterfaceType>
102 static InterfaceType* ExtractOrientationModes(CImageCropDecalibrateProcessorComp& component)
103 {
104 return &component.m_orientationModes;
105 }
106
107 I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
108 I_REF(i2d::CRectangle, m_defaultAoiCompPtr);
109 I_ATTR(QByteArray, m_interpolationModeParamIdAttrPtr);
110 I_REF(iprm::ISelectionParam, m_defaultInterpolationModeCompPtr);
111 I_ATTR(QByteArray, m_orientationModeParamIdAttrPtr);
112 I_REF(iprm::ISelectionParam, m_defaultOrientationModeCompPtr);
113 I_ATTR(int, m_cellSizeAttrPtr);
114
115 iprm::COptionsManager m_interpolationModes;
116 iprm::COptionsManager m_orientationModes;
117};
118
119
120} // namespace iipr
121
122
123#endif // !iipr_CImageCropDecalibrateProcessorComp_included
124
125
Definition of rectangle area orthogonal to axis of coordination system.
Definition CRectangle.h:31
Definition of an affine transformation for 2D-spaces.
Definition of single plane bitmap.
Definition IBitmap.h:24
Crop the image region and rectificate (de-calibrate) it.
virtual iproc::CTaskState DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, bool allowAsync=false, iproc::IProgressManager *progressManagerPtr=nullptr) override
static bool CalcCalibration(const i2d::CRectangle &sourceAoi, icalib::CAffineCalibration2d &outputCalib, istd::CIndex2d *outputImageSizePtr=nullptr, int orientationMode=OM_SIMPLE)
static bool CalcOutputImageSize(const i2d::CRectangle &sourceAoi, istd::CIndex2d &result)
static bool CropImage(const i2d::CRectangle &sourceAoi, int cellSize, const iimg::IBitmap &inputBitmap, iimg::IBitmap &outputBitmap, istd::CIndex2d *outputImageSizePtr=nullptr, int interpolationMode=IM_LINEAR, int orientationMode=OM_SIMPLE, ilog::IMessageConsumer *resultConsumerPtr=nullptr)
Common interface for a message container consuming information objects (messages).
Implementation of a simple options manager.
Constraints of selection from set of possibilities.
Set of general parameters.
Definition IParamsSet.h:29
Interface allowing to select single option from list of options.
Represent state of asynchronous operation.
Definition CTaskState.h:28
Interface for all synchrone and asynchrone processors with "push data" model.
Definition IProcessor.h:26
Consume information about progress of some process.
Simple definition macro for a synchronous processor.
Index implementation for addressing elements in 2D-space.
Definition CIndex2d.h:25
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy