KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
texture.h
Go to the documentation of this file.
1 // orientation_energy.h - compute orientation energy
3 // Author: Doron Tal
4 // Date Created: March, 2000
5 
6 #ifndef _TEXTURE_CPP_H
7 #define _TEXTURE_CPP_H
8 
9 
10 #include <string>
11 #include "wrap_dtlib_cpp/img.h"
13 #include "m_cpp/m_matrix.h"
14 #include "i_cpp/i_image.h"
15 #include "wrap_dtlib_cpp/jpeg.h"
16 #include "wrap_dtlib_cpp/kmeans.h"
20 #include "wrap_dtlib_cpp/median.h"
30 
31 namespace DTLib
32 {
33 
35 (
36  FloatCImgPtr m_pInputImage,
37  CFilterbank** m_pFilterbank_ptr,
38  FloatCImgVecPtr * m_pConvVec_ptr,
39  int m_nGaussScales,
40  int m_nGaussOrientations,
41  float m_GaussSigmaY,
42  float m_GaussX2YSigmaRatio,
43  int m_nDOGScales,
44  float m_DOGExcitSigma,
45  float m_DOGInhibSigmaRatio1,
46  float m_DOGInhibSigmaRatio2
47 );
48 
50 (
51  FloatCImgPtr m_pInputImage,
52  CFilterbank* m_pFilterbank,
53  FloatCImgVecPtr m_pConvVec,
54  FloatCImgVecPtr * m_pOEVec,
55  int m_nGaussScales,
56  int m_nGaussOrientations
57 );
58 
59 void extract_texture
60 (
61  const kjb::Image & img,
62  const kjb::Int_matrix & seg_map,
63  kjb::Matrix & Oe_mean,
64  kjb::Matrix & Oe_var,
65  kjb::Matrix & DOG_mean,
66  kjb::Matrix & DOG_var,
67  int m_nGaussScales,
68  int m_nGaussOrientations,
69  float m_GaussSigmaY,
70  float m_GaussX2YSigmaRatio,
71  int m_nDOGScales,
72  float m_DOGExcitSigma,
73  float m_DOGInhibSigmaRatio1,
74  float m_DOGInhibSigmaRatio2,
75  int m_nCroppedPixels
76 );
77 
79 (
80  const kjb::Image & img,
81  FloatCImgPtr * m_pAImg,
82  FloatCImgPtr * m_pBImg,
83  int m_nCroppedPixels,
84  bool & m_bColor
85 );
86 
87 void do_textons
88 (
89  FloatCImgVecPtr m_pConvVec,
90  LongCImgPtr * m_pTextonsImg,
91  int m_nGaussScales,
92  int m_nGaussOrientations,
93  int m_nDOGScales,
94  int m_InputWidth,
95  int m_InputHeight,
96  int m_nTextureKMeansK,
97  int m_nTextureKMeansIterations
98 );
99 
100 void ComputeTextonHistoImg();
101 
102 CCircleMasks* ComputeCircleMasks
103 (
104  int m_minTextureScale,
105  int m_maxTextureScale
106 );
107 
109 (
110  LongCImgPtr m_pTextonsImg,
111  CTextureScale** m_pTS,
112  int m_InputWidth,
113  int m_InputHeight,
114  int m_nTextureKMeansK,
115  float m_TextureMinDist,
116  float m_TextureMaxDist,
117  float m_TextureAlphaScaleFactor,
118  int & m_minTextureScale,
119  int & m_maxTextureScale
120 );
121 
123 (
124  DTLib::CCircleMasks* m_pCircleMasks,
125  FloatCImgPtr m_pTextureScaleImg,
126  LongCImgPtr m_pTextonsImg,
127  ByteCImgPtr m_pNMSCombImg,
128  FloatCImgPtr m_pOriCombImg,
129  int m_InputWidth,
130  int m_InputHeight,
131  int m_minTextureScale,
132  int m_maxTextureScale,
133  int m_nTextureKMeansK,
134  float m_TextureDiskMiddleWidth,
135  float m_TextureTau,
136  float m_TextureBeta
137 );
138 
140 (
141  CFilterbank * m_pFilterbank,
142  FloatCImgVecPtr m_pOEVec,
143  CImgVec<BYTE> ** m_pNMSVec,
144  CImgVec<float> ** m_pEnergyVec,
145  CImgVec<float> ** m_pOriVec,
146  CImgVec<float> ** m_pXLocVec,
147  CImgVec<float> ** m_pYLocVec,
148  CImgVec<float> ** m_pErrVec,
149  int m_nGaussScales,
150  int m_nGaussOrientations,
151  int m_InputWidth,
152  int m_InputHeight
153 );
154 
155 void CombineScales
156 (
157  CImgVec<BYTE> * m_pNMSVec,
158  CImgVec<float> * m_pEnergyVec,
159  CImgVec<float> * m_pOriVec,
160  ByteCImgPtr * m_pNMSCombImg,
161  FloatCImgPtr * m_pOriCombImg,
162  FloatCImgPtr * m_pEnergyCombImg,
163  int m_InputWidth,
164  int m_InputHeight,
165  int m_nGaussScales
166 );
167 
169 (
170  LongCImgPtr m_pTextonsImg,
171  FloatCImgPtr m_pTextureScaleImg,
172  FloatCImgPtr m_pPTextureImg,
173  DTLib::CCircleMasks* m_pCircleMasks,
174  CImg<FloatCHistogramPtr>** m_pTextonHistoImg,
175  int m_InputWidth,
176  int m_InputHeight,
177  int m_nTextureKMeansK
178 );
179 
180 void ComputeWeberLaw
181 (
182  CFilterbank* m_pFilterbank_ptr,
183  FloatCImgVecPtr m_pConvVec_ptr,
184  float m_TextureWeberLawConst
185 );
186 
187 
189 (
190  const kjb::Image & img,
191  CImg<FloatCHistogramPtr>** m_pTextonHistoImg,
192  CImg<FloatCHistogramPtr>** ColorHist,
193  FloatCImgPtr * m_pDualHImg,
194  FloatCImgPtr * m_pDualVImg,
195  ByteCImgPtr * m_pSparsePatImg,
196  int m_nGaussScales,
197  int m_nGaussOrientations,
198  float m_GaussSigmaY,
199  float m_GaussX2YSigmaRatio,
200  int m_nDOGScales,
201  float m_DOGExcitSigma,
202  float m_DOGInhibSigmaRatio1,
203  float m_DOGInhibSigmaRatio2,
204  int m_nCroppedPixels,
205  float m_TextureWeberLawConst,
206  int m_nTextureKMeansK,
207  int m_nTextureKMeansIterations,
208  float m_TextureMinDist,
209  float m_TextureMaxDist,
210  float m_TextureAlphaScaleFactor,
211  float m_TextureDiskMiddleWidth,
212  float m_TextureTau,
213  float m_TextureBeta,
214  int m_nBinsA,
215  int m_nBinsB,
216  int m_nBinsC,
217  float m_ColorHistoSoftBinSigma,
218  float m_EdgelLength,
219  float m_InterveningContourSigma,
220  int m_SparsePatternDenseRad,
221  int m_SparsePatternMaxRad,
222  int m_nSparsePatternSamples,
223  bool & m_bColor
224 );
225 
227 (
228  const kjb::Image & img,
229  CImg<FloatCHistogramPtr> ** m_pTextonHistoImg,
230  CImg<FloatCHistogramPtr> ** ColorHist
231 );
232 
234 (
235  const kjb::Image & img,
236  CImg<FloatCHistogramPtr> ** ColorHist,
237  int m_nBinsA = 8,
238  int m_nBinsB = 8,
239  int m_nBinsC = 8,
240  float m_ColorHistoSoftBinSigma = 1.8f,
241  int m_nCroppedPixels = 10,
242  int m_nGaussScales = 3,
243  int m_nGaussOrientations = 12,
244  float m_GaussSigmaY = 1.41f,
245  float m_GaussX2YSigmaRatio = 3.0f,
246  int m_nDOGScales = 3,
247  float m_DOGExcitSigma = 1.41f,
248  float m_DOGInhibSigmaRatio1 = 0.62f,
249  float m_DOGInhibSigmaRatio2 = 1.6f,
250  float m_TextureMinDist = 3.0f,
251  float m_TextureMaxDist = 0.1f,
252  float m_TextureAlphaScaleFactor = 1.5f,
253  float m_TextureDiskMiddleWidth = 3.0f
254 );
255 
256 CImg<FloatCHistogramPtr>* ComputeColorHistoImg
257 (
258  FloatCImgPtr m_pTextureScaleImg,
259  CCircleMasks* m_pCircleMasks,
260  FloatCImgPtr m_pAImg,
261  FloatCImgPtr m_pBImg,
262  FloatCImgPtr m_pCImg,
263  int m_InputWidth,
264  int m_InputHeight,
265  int m_nBinsA,
266  int m_nBinsB,
267  int m_nBinsC,
268  float m_ColorHistoSoftBinSigma,
269  bool is_colour
270 );
271 
273 (
274  CImgVec<float> * m_pEnergyVec,
275  CImgVec<float> * m_pOriVec,
276  CImgVec<BYTE> * m_pNMSVec,
277  CImgVec<float> * m_pXLocVec,
278  CImgVec<float> * m_pYLocVec,
279  FloatCImgPtr m_pPTextureImg,
280  FloatCImgPtr * m_pDualHImg,
281  FloatCImgPtr * m_pDualVImg,
282  int m_InputWidth,
283  int m_InputHeight,
284  int m_nGaussScales,
285  float m_EdgelLength,
286  float m_InterveningContourSigma
287 );
288 
290 (
291  int m_SparsePatternDenseRad,
292  int m_SparsePatternMaxRad,
293  int m_nSparsePatternSamples
294 );
295 
296 CImg<FloatCHistogramPtr>* ReadHistoImg(const std::string & file_name);
297 
298 void WriteHistoImg
299 (
300  const std::string & file_name,
301  CImg<FloatCHistogramPtr> * pHistoImg
302 );
303 
304 CImg<FloatCHistogramPtr>* ReadTextonHistoImg(const std::string & file_name);
305 
306 CImg<FloatCHistogramPtr>* ReadColorHistoImg(const std::string & file_name);
307 
309 (
310  const std::string & file_name,
311  CImg<FloatCHistogramPtr>* pHistoImg
312 );
313 
315 (
316  const std::string & file_name,
317  CImg<FloatCHistogramPtr>* pHistoImg
318 );
319 
320 void PrepareHeatMap
321 (
322  kjb::Image & img,
323  CImg<FloatCHistogramPtr>* pHistoImg,
324  int padding,
325  int x_position,
326  int y_position
327 );
328 
329 
330 }
331 #endif /* #ifndef _ORIENTATION_ENERGY_H */
void extract_texture(const kjb::Image &img, const kjb::Int_matrix &seg_map, kjb::Matrix &Oe_mean, kjb::Matrix &Oe_var, kjb::Matrix &DOG_mean, kjb::Matrix &DOG_var, int m_nGaussScales, int m_nGaussOrientations, float m_GaussSigmaY, float m_GaussX2YSigmaRatio, int m_nDOGScales, float m_DOGExcitSigma, float m_DOGInhibSigmaRatio1, float m_DOGInhibSigmaRatio2, int m_nCroppedPixels)
Definition: texture.cpp:291
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
void WriteTextonHistoImg(const std::string &file_name, CImg< FloatCHistogramPtr > *pHistoImg)
Definition: texture.cpp:146
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements...
Definition: l_int_matrix.h:71
void WriteColorHistoImg(const std::string &file_name, CImg< FloatCHistogramPtr > *pHistoImg)
Definition: texture.cpp:175
void WriteHistoImg(const std::string &file_name, CImg< FloatCHistogramPtr > *pHistoImg)
Definition: texture.cpp:212
CImgVec< float > * FloatCImgVecPtr
Definition: img.h:2520
void ComputeWeberLaw(CFilterbank *m_pFilterbank_ptr, FloatCImgVecPtr m_pConvVec_ptr, float m_TextureWeberLawConst)
Definition: texture.cpp:684
CImg< float > * FloatCImgPtr
Definition: img.h:2515
void ComputeColorHistoImg(const kjb::Image &img, CImg< FloatCHistogramPtr > **ColorHist, int m_nBinsA=8, int m_nBinsB=8, int m_nBinsC=8, float m_ColorHistoSoftBinSigma=1.8f, int m_nCroppedPixels=10, int m_nGaussScales=3, int m_nGaussOrientations=12, float m_GaussSigmaY=1.41f, float m_GaussX2YSigmaRatio=3.0f, int m_nDOGScales=3, float m_DOGExcitSigma=1.41f, float m_DOGInhibSigmaRatio1=0.62f, float m_DOGInhibSigmaRatio2=1.6f, float m_TextureMinDist=3.0f, float m_TextureMaxDist=0.1f, float m_TextureAlphaScaleFactor=1.5f, float m_TextureDiskMiddleWidth=3.0f)
Definition: texture.cpp:823
CImg< FloatCHistogramPtr > * ReadTextonHistoImg(const std::string &file_name)
Definition: texture.cpp:33
void do_textons(FloatCImgVecPtr m_pConvVec, LongCImgPtr *m_pTextonsImg, int m_nGaussScales, int m_nGaussOrientations, int m_nDOGScales, int m_InputWidth, int m_InputHeight, int m_nTextureKMeansK, int m_nTextureKMeansIterations)
Definition: texture.cpp:428
CImg< FloatCHistogramPtr > * ReadHistoImg(const std::string &file_name)
Definition: texture.cpp:15
void ComputeTextonHistoImg()
FloatCImgPtr convert_kjb_to_CImg(const kjb::Image &img, FloatCImgPtr *m_pAImg, FloatCImgPtr *m_pBImg, int m_nCroppedPixels, bool &m_bColor)
Definition: texture.cpp:330
CCircleMasks * ComputeCircleMasks(int m_minTextureScale, int m_maxTextureScale)
Definition: texture.cpp:501
void ComputeOrientationEnergy(FloatCImgPtr m_pInputImage, CFilterbank *m_pFilterbank, FloatCImgVecPtr m_pConvVec, FloatCImgVecPtr *m_pOEVec, int m_nGaussScales, int m_nGaussOrientations)
Definition: texture.cpp:268
void PrepareHeatMap(kjb::Image &img, CImg< FloatCHistogramPtr > *pHistoImg, int padding, int x_position, int y_position)
Definition: texture.cpp:1029
void Compute_All_Histograms(const kjb::Image &img, CImg< FloatCHistogramPtr > **m_pTextonHistoImg, CImg< FloatCHistogramPtr > **ColorHist)
Definition: texture.cpp:1070
Definition: circle.h:16
void CombineScales(CImgVec< BYTE > *m_pNMSVec, CImgVec< float > *m_pEnergyVec, CImgVec< float > *m_pOriVec, ByteCImgPtr *m_pNMSCombImg, FloatCImgPtr *m_pOriCombImg, FloatCImgPtr *m_pEnergyCombImg, int m_InputWidth, int m_InputHeight, int m_nGaussScales)
Definition: texture.cpp:658
void ComputeDualLattice(CImgVec< float > *m_pEnergyVec, CImgVec< float > *m_pOriVec, CImgVec< BYTE > *m_pNMSVec, CImgVec< float > *m_pXLocVec, CImgVec< float > *m_pYLocVec, FloatCImgPtr m_pPTextureImg, FloatCImgPtr *m_pDualHImg, FloatCImgPtr *m_pDualVImg, int m_InputWidth, int m_InputHeight, int m_nGaussScales, float m_EdgelLength, float m_InterveningContourSigma)
Definition: texture.cpp:987
FloatCImgPtr ComputeTextureScale(LongCImgPtr m_pTextonsImg, CTextureScale **m_pTS, int m_InputWidth, int m_InputHeight, int m_nTextureKMeansK, float m_TextureMinDist, float m_TextureMaxDist, float m_TextureAlphaScaleFactor, int &m_minTextureScale, int &m_maxTextureScale)
Definition: texture.cpp:512
void ComputeNonmaximaSuppression(CFilterbank *m_pFilterbank, FloatCImgVecPtr m_pOEVec, CImgVec< BYTE > **m_pNMSVec, CImgVec< float > **m_pEnergyVec, CImgVec< float > **m_pOriVec, CImgVec< float > **m_pXLocVec, CImgVec< float > **m_pYLocVec, CImgVec< float > **m_pErrVec, int m_nGaussScales, int m_nGaussOrientations, int m_InputWidth, int m_InputHeight)
Definition: texture.cpp:600
CImg< kjb_int32 > * LongCImgPtr
Definition: img.h:2514
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
Code for a wrapper class around the C struct KJB_Image.
CImg< BYTE > * ByteCImgPtr
TYPES.
Definition: img.h:2513
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76
CImg< FloatCHistogramPtr > * ReadColorHistoImg(const std::string &file_name)
Definition: texture.cpp:74
void Compute_Textons_Histograms(const kjb::Image &img, CImg< FloatCHistogramPtr > **m_pTextonHistoImg, CImg< FloatCHistogramPtr > **ColorHist, FloatCImgPtr *m_pDualHImg, FloatCImgPtr *m_pDualVImg, ByteCImgPtr *m_pSparsePatImg, int m_nGaussScales, int m_nGaussOrientations, float m_GaussSigmaY, float m_GaussX2YSigmaRatio, int m_nDOGScales, float m_DOGExcitSigma, float m_DOGInhibSigmaRatio1, float m_DOGInhibSigmaRatio2, int m_nCroppedPixels, float m_TextureWeberLawConst, int m_nTextureKMeansK, int m_nTextureKMeansIterations, float m_TextureMinDist, float m_TextureMaxDist, float m_TextureAlphaScaleFactor, float m_TextureDiskMiddleWidth, float m_TextureTau, float m_TextureBeta, int m_nBinsA, int m_nBinsB, int m_nBinsC, float m_ColorHistoSoftBinSigma, float m_EdgelLength, float m_InterveningContourSigma, int m_SparsePatternDenseRad, int m_SparsePatternMaxRad, int m_nSparsePatternSamples, bool &m_bColor)
Definition: texture.cpp:698
FloatCImgPtr ComputePTexture(DTLib::CCircleMasks *m_pCircleMasks, FloatCImgPtr m_pTextureScaleImg, LongCImgPtr m_pTextonsImg, ByteCImgPtr m_pNMSCombImg, FloatCImgPtr m_pOriCombImg, int m_InputWidth, int m_InputHeight, int m_minTextureScale, int m_maxTextureScale, int m_nTextureKMeansK, float m_TextureDiskMiddleWidth, float m_TextureTau, float m_TextureBeta)
Definition: texture.cpp:561
ByteCImgPtr ComputeSparsePattern(int m_SparsePatternDenseRad, int m_SparsePatternMaxRad, int m_nSparsePatternSamples)
Definition: texture.cpp:1018
void FilterbankConvolve(FloatCImgPtr m_pInputImage, CFilterbank **m_pFilterbank_ptr, FloatCImgVecPtr *m_pConvVec_ptr, int m_nGaussScales, int m_nGaussOrientations, float m_GaussSigmaY, float m_GaussX2YSigmaRatio, int m_nDOGScales, float m_DOGExcitSigma, float m_DOGInhibSigmaRatio1, float m_DOGInhibSigmaRatio2)
Definition: texture.cpp:230