IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
LawTexture2dImgLvl1.h
1 // LawTexture2dImgLvl1.h:
3 // ----------------------
4 //
14 
15 #ifndef __IPSDKIPLSTATS_LAWTEXTURE2DIMGLVL1_H__
16 #define __IPSDKIPLSTATS_LAWTEXTURE2DIMGLVL1_H__
17 
23 
25 
26 // Attributes headers
27 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/InOptLawTextureKernel2dTypes.h>
28 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/InOptLawTexPreProcParams.h>
29 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/InOptLawTexPostProcParams.h>
30 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Input/InSingleImg.h>
31 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Output/OutRealImg.h>
32 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Output/Working/Optional/OutOptWk1RealImg.h>
33 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Output/Working/Optional/OutOptWk2RealImg.h>
34 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Image/Output/Working/OutWk1RealImg.h>
35 
36 #include <map>
37 #include <set>
38 
39 namespace ipsdk {
40 namespace imaproc {
41 namespace stats {
42 
43 struct LawTex2dConvolRes;
44 typedef boost::shared_ptr<LawTex2dConvolRes> LawTex2dConvolResPtr;
45 
48 
49 // declare processor class
50 IPSDK_DECLARE_LVL1_PROCESSOR(REP_ASYNC1, IPSDKIPLStats, LawTexture2dImg,
51  ipsdk::imaproc::matchSize(_pInSingleImg, _pOutWk1RealImg) &&
52  (ipsdk::processor::ifIsSet(_pOutOptWk1RealImg,
53  ipsdk::imaproc::matchSize(_pInSingleImg, _pOutOptWk1RealImg))) &&
54  (ipsdk::processor::ifIsSet(_pOutOptWk2RealImg,
55  ipsdk::imaproc::matchSize(_pInSingleImg, _pOutOptWk2RealImg))),
56  (((ipsdk)(imaproc)(attr))(InSingleImg))
57  (((ipsdk)(imaproc)(attr))(InOptLawTextureKernel2dTypes))
58  (((ipsdk)(imaproc)(attr))(InOptLawTexPreProcParams))
59  (((ipsdk)(imaproc)(attr))(InOptLawTexPostProcParams))
60  (((ipsdk)(imaproc)(attr))(OutRealImg)(customOutput)(outputLawTexture2d(_pInSingleImg, _pInOptLawTextureKernel2dTypes)))
61  (((ipsdk)(imaproc)(attr))(OutWk1RealImg)(ipsdk::imaproc::duplicateInOut)(_pInSingleImg)(ipsdk::image::eImageBufferType::eIBT_Real32))
62  (((ipsdk)(imaproc)(attr))(OutOptWk1RealImg))
63  (((ipsdk)(imaproc)(attr))(OutOptWk2RealImg)))
64 
65 // methods
66 public:
67 
68 protected:
69  typedef std::string FinalImageId;
70  typedef std::string WorkImageId;
71  typedef std::map<FinalImageId, std::pair<image::ImagePtr, WorkImageId> > MapImages;
72 
73  processor::RetrievalResult meanSmoothing(
74  const image::ImageConstPtr& pInImg,
75  const image::ImagePtr& pOutImg,
76  const ipUInt32 halfKnlSize,
77  const core::BasePriority& priority,
78  core::ActionProviderPtr& pProvider);
79 
80  processor::RetrievalResult gaussianSmoothing(
81  const image::ImageConstPtr& pInImg,
82  const image::ImagePtr& pOutImg,
83  const ipReal32 stdDev,
84  const attr::GaussianCoverage& gaussianCoverage,
85  const core::BasePriority& priority,
86  core::ActionProviderPtr& pProvider);
87 
88  processor::RetrievalResult smoothInputImg(
89  const core::BasePriority& priority,
90  core::ActionProviderPtr& pProvider);
91 
92  processor::RetrievalResult subtractSmoothedToInputImg(
93  const core::BasePriority& priority,
94  core::ActionProviderPtr& pProvider);
95 
97  const image::ImageConstPtr& pInImg,
98  const KernelXYPtr& pKnl,
99  const image::ImagePtr& pOutImg,
100  const core::BasePriority& priority,
101  core::ActionProviderPtr& pProvider);
102 
103  processor::RetrievalResult convolveXKernel(
104  char kernelId,
105  const core::BasePriority& priority,
106  core::ActionProviderPtr& pProvider);
107 
108  processor::RetrievalResult convolveYKernel(
109  const std::string& kernelId,
110  const core::BasePriority& priority,
111  core::ActionProviderPtr& pProvider);
112 
113  processor::RetrievalResult computeAbsImg(
114  const core::BasePriority& priority,
115  core::ActionProviderPtr& pProvider);
116 
117  processor::RetrievalResult blendAB_BA(
118  const std::string& kernelId,
119  const image::ImagePtr& pLastImgConvol2D,
120  const core::BasePriority& priority,
122 
123  processor::RetrievalResult computeEnergyMap(
124  const core::BasePriority& priority,
125  core::ActionProviderPtr& pProvider);
126 
127  processor::RetrievalResult provideProcessor(
128  const boost::shared_ptr<core::BaseAction>& pProcessor,
129  const core::BasePriority& priority,
130  core::ActionProviderPtr& pProvider);
131 
132  void build1DKernels();
133  BoolResult buildConvolQueues();
134 
135  BoolResult insertKernelType(const std::string& id, const ipUInt32 frameIx);
136 
137  image::ImagePtr takeGreatestAvailableElementInImagesMapWithKeyGreaterThan(
138  const WorkImageId& id);
139 
140  image::ImagePtr takeElementInImagesMap(
141  const FinalImageId& finalId,
142  const WorkImageId& workId);
143 
144  BoolResult pickImage(const WorkImageId& id, image::ImagePtr& pImg);
145  BoolResult takeInitializedOptWk1Image(const WorkImageId& id, image::ImagePtr& pOutOptWk1Img);
146  BoolResult takeInitializedOptWk2Image(const WorkImageId& id, image::ImagePtr& pOutOptWk2Img);
147  void releaseImage(const WorkImageId& id);
148  bool doAllConvolsLeftStartWithSameLetter() const;
149 // attributes
150 protected:
151  std::map<char, KernelXYPtr> _mapKnlX;
152  std::map<char, KernelXYPtr> _mapKnlY;
153 
154  MapImages _workImages;
155  std::map<std::string, LawTex2dConvolResPtr> _convolsToCompute;
156 
157  // border policy used for convolutions
158  image::Border2dPolicyPtr _pBorder2dPolicy;
159 
160  WorkImageId _optWk1RealImgId;
161  WorkImageId _optWk2RealImgId;
162 };
163 
166 
167 } // end of namespace stats
168 } // end of namespace imaproc
169 } // end of namespace ipsdk
170 
171 #endif // __IPSDKIPLSTATS_LAWTEXTURE2DIMGLVL1_H__
ProcessingResult< eRetrievalResultType > RetrievalResult
#define IPSDK_DECLARE_LVL1_PROCESSOR(ProcType, libraryName, algoName, RuleString, attributeSeq)
boost::shared_ptr< BaseImage > ImagePtr
processor::OutputInitializerPtr duplicateInOut(const boost::weak_ptr< OutputAttributeType > &pOutputAttribute, const boost::weak_ptr< InputAttributeType > &pInputAttribute, const eImageInitializerStoragePolicy &storagePolicy=eImageInitializerStoragePolicy::eIISP_Inherit)
boost::enable_if_c< AttributeType::g_bOptional, RulePtr >::type ifIsSet(const boost::shared_ptr< AttributeType > &pAttribute, const RulePtr &pRuleTrue)
boost::shared_ptr< Border2dPolicy > Border2dPolicyPtr
processor::OutputInitializerPtr customOutput(const boost::weak_ptr< OutputAttributeType > &pOutputAttribute, const CustomImageInfoPtr &pCustomImageInfo)
Utility functions for Law&#39;s texture filter attribute output initialization management.
Definition of import/export macro for library.
boost::shared_ptr< KernelXY > KernelXYPtr
boost::shared_ptr< const BaseImage > ImageConstPtr
boost::shared_ptr< BaseActionProvider > ActionProviderPtr
IPSDKIPLSTATS_API CustomImageInfoPtr outputLawTexture2d(const ImageAttributeConstPtr &pInputImgAttribute, const boost::shared_ptr< attr::InOptLawTextureKernel2dTypes > &pInKernelTypesAttribute)
function allowing to create a Law&#39;s texture 2d filter output image initializer
float ipReal32
uint32_t ipUInt32