ICF 3.0.5.47
Technical documentation of ICF Libraries
CCaliperLineFinderComp.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#pragma once
7
8
9// ICF includes
11#include <i2d/CLine2d.h>
12#include <i2d/CParallelogram.h>
13#include <i2d/CPolypoint.h>
15
23
24
25namespace iipr
26{
27
28
36 public iproc::TSyncProcessorCompBase<IImageToFeatureProcessor>,
37 protected CCaliperFinderBase
38{
39public:
41
42 I_BEGIN_COMPONENT(CCaliperLineFinderComp);
43 I_REGISTER_INTERFACE(IImageToFeatureProcessor);
44 I_REGISTER_INTERFACE(iproc::IProcessor);
45 I_ASSIGN(m_slaveProcessorCompPtr, "SlaveEdgeProcessor", "Slave edge finder processor converting image to list of found edges", true, "SlaveEdgeProcessor");
46 I_ASSIGN(m_featuresMapperCompPtr, "FeaturesMapper", "Calculate position from caliper extracted features", true, "FeaturesMapper");
47 I_ASSIGN(m_resultCalibrationCompPtr, "ResultCalibration", "Calibration should be used for result", false, "ResultCalibration");
48 I_ASSIGN(m_aoiParamIdAttrPtr, "AoiParamId", "ID of area of interest in parameter set", true, "AoiParams");
49 I_ASSIGN(m_finderParamsIdAttrPtr, "CaliperFinderParamsId", "ID of caliper finder parameters in parameter set (iipr::ICaliperFinderParams)", true, "CaliperFinderParams");
50 I_ASSIGN(m_slaveLineIdAttrPtr, "SlaveLineId", "ID of line parameter added by this processor to parameter set for slave edge processor", true, "LineParam");
51 I_ASSIGN(m_searchParallelLinesAttrPtr, "SearchParallelLines", "If it is true, parallel lines will be searched", true, false);
52 I_ASSIGN(m_sendUsedPointsToTempAttrPtr, "SendUsedPointsToTemp", "If true, the used point positions will be send to temporary results", true, false);
53 I_ASSIGN(m_sendLinesToTempAttrPtr, "SendLinesToTemp", "If true, the caliper lines will be send to temporary results", true, false);
54 I_ASSIGN(m_resultConsumerCompPtr, "ResultConsumer", "Consumer of result messages with geometrical layout", false, "ResultConsumer");
55 I_ASSIGN(m_tempConsumerCompPtr, "TempConsumer", "Consumer of temporary result messages", false, "TempResultsConsumer");
56 I_END_COMPONENT;
57
59
60 // reimplemented (iipr::IImageToFeatureProcessor)
62 const iprm::IParamsSet* paramsPtr,
63 const iimg::IBitmap& image,
64 IFeaturesConsumer& results,
65 iproc::IProgressManager* progressManagerPtr = nullptr) override;
66
67 // reimplemented (iproc::IProcessor)
69 const iprm::IParamsSet* paramsPtr,
70 const istd::IPolymorphic* inputPtr,
71 istd::IChangeable* outputPtr,
72 bool allowAsync = false,
73 iproc::IProgressManager* progressManagerPtr = nullptr) override;
74
75 // static methods
83 static double CalculateLine(
84 const i2d::CVector2d& direction,
85 double minOutliersDist,
86 Rays& rays,
87 i2d::CLine2d& result);
96 const i2d::CVector2d& direction,
97 double minOutliersDist,
98 Rays& inRays,
99 Rays& outRays,
100 i2d::CParallelogram& result);
101
102protected:
103 double DoFindSingleLine(const iprm::IParamsSet* paramsPtr, const iimg::IBitmap& image, i2d::CLine2d& result);
104 double DoFindParallelLines(const iprm::IParamsSet* paramsPtr, const iimg::IBitmap& image, i2d::CParallelogram& result);
105
106 bool CalcRays(const iprm::IParamsSet* paramsPtr, const iimg::IBitmap& image, Rays& inRays, Rays& outRays, double& minOutlierDist);
107 void AddIntermediateResults(const Rays& outRays, const QString& name);
108
109 // reimplemented (icomp::CComponentBase)
110 void OnComponentCreated() override;
111
112private:
113 I_REF(iproc::IProcessor, m_slaveProcessorCompPtr);
114 I_REF(iipr::IFeatureToImageMapper, m_featuresMapperCompPtr);
115 I_REF(i2d::ICalibration2d, m_resultCalibrationCompPtr);
116 I_ATTR(QByteArray, m_aoiParamIdAttrPtr);
117 I_ATTR(QByteArray, m_slaveLineIdAttrPtr);
118 I_ATTR(QByteArray, m_finderParamsIdAttrPtr);
119 I_ATTR(bool, m_searchParallelLinesAttrPtr);
120 I_ATTR(bool, m_sendUsedPointsToTempAttrPtr);
121 I_ATTR(bool, m_sendLinesToTempAttrPtr);
122 I_REF(ilog::IMessageConsumer, m_resultConsumerCompPtr);
123 I_REF(ilog::IMessageConsumer, m_tempConsumerCompPtr);
124};
125
126
127} // namespace iipr
128
129
Definition of a line in 2D-space.
Definition CLine2d.h:26
This class defines parallelogram.
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Definition of single plane bitmap.
Definition IBitmap.h:24
Base class for caliper based finder.
Caliper based line finder.
double DoFindParallelLines(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, i2d::CParallelogram &result)
bool CalcRays(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, Rays &inRays, Rays &outRays, double &minOutlierDist)
void OnComponentCreated() override
virtual iproc::CTaskState DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, bool allowAsync=false, iproc::IProgressManager *progressManagerPtr=nullptr) override
iproc::TSyncProcessorCompBase< IImageToFeatureProcessor > BaseClass
virtual iproc::CTaskState DoExtractFeatures(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, IFeaturesConsumer &results, iproc::IProgressManager *progressManagerPtr=nullptr) override
void AddIntermediateResults(const Rays &outRays, const QString &name)
static double CalculateLine(const i2d::CVector2d &direction, double minOutliersDist, Rays &rays, i2d::CLine2d &result)
Calculate line based on the list of rays.
double DoFindSingleLine(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &image, i2d::CLine2d &result)
static double CalculateParallelLines(const i2d::CVector2d &direction, double minOutliersDist, Rays &inRays, Rays &outRays, i2d::CParallelogram &result)
Calculate parallel lines based on the list of rays.
Interface allowing mapping of extracted features to native coordinate systems.
Common interface for a features container consuming feature objects.
Allow to extract some features from the image.
Common interface for a message container consuming information objects (messages).
Set of general parameters.
Definition IParamsSet.h:29
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.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains the image processing classes.

© Witold Gantzke and Kirill Lepskiy