Blender  V2.93
ImagePyramid.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <vector>
25 
26 #include "../system/FreestyleConfig.h"
27 
28 #ifdef WITH_CXX_GUARDEDALLOC
29 # include "MEM_guardedalloc.h"
30 #endif
31 
32 namespace Freestyle {
33 
34 class GrayImage;
35 
36 class ImagePyramid {
37  protected:
38  std::vector<GrayImage *> _levels;
39 
40  public:
42  {
43  }
44  ImagePyramid(const ImagePyramid &iBrother);
45  // ImagePyramid(const GrayImage& level0, unsigned nbLevels);
46  virtual ~ImagePyramid();
47 
52  virtual void BuildPyramid(const GrayImage &level0, unsigned nbLevels) = 0;
53 
55  virtual void BuildPyramid(GrayImage *level0, unsigned nbLevels) = 0;
56 
57  virtual GrayImage *getLevel(int l);
66  virtual float pixel(int x, int y, int level = 0);
67 
69  virtual int width(int level = 0);
70 
72  virtual int height(int level = 0);
73 
75  inline int getNumberOfLevels() const
76  {
77  return _levels.size();
78  }
79 
80 #ifdef WITH_CXX_GUARDEDALLOC
81  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ImagePyramid")
82 #endif
83 };
84 
85 class GaussianPyramid : public ImagePyramid {
86  protected:
87  float _sigma;
88 
89  public:
90  GaussianPyramid(float iSigma = 1.0f) : ImagePyramid()
91  {
92  _sigma = iSigma;
93  }
94 
95  GaussianPyramid(const GrayImage &level0, unsigned nbLevels, float iSigma = 1.0f);
96  GaussianPyramid(GrayImage *level0, unsigned nbLevels, float iSigma = 1.0f);
97  GaussianPyramid(const GaussianPyramid &iBrother);
98  virtual ~GaussianPyramid()
99  {
100  }
101 
102  virtual void BuildPyramid(const GrayImage &level0, unsigned nbLevels);
103  virtual void BuildPyramid(GrayImage *level0, unsigned nbLevels);
104 
105  /* accessors */
106  inline float getSigma() const
107  {
108  return _sigma;
109  }
110 
111  /* modifiers */
112 };
113 
114 } /* namespace Freestyle */
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMLoop * l
virtual void BuildPyramid(const GrayImage &level0, unsigned nbLevels)
GaussianPyramid(float iSigma=1.0f)
Definition: ImagePyramid.h:90
virtual float pixel(int x, int y, int level=0)
virtual GrayImage * getLevel(int l)
virtual void BuildPyramid(const GrayImage &level0, unsigned nbLevels)=0
int getNumberOfLevels() const
Definition: ImagePyramid.h:75
virtual int height(int level=0)
virtual int width(int level=0)
std::vector< GrayImage * > _levels
Definition: ImagePyramid.h:38
virtual void BuildPyramid(GrayImage *level0, unsigned nbLevels)=0
inherits from class Rep
Definition: AppCanvas.cpp:32
static unsigned x[3]
Definition: RandGen.cpp:87