SourceXtractorPlusPlus  0.15
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MirrorImage.h
Go to the documentation of this file.
1 
17 /*
18  * @file SEFramework/Image/ReflectImage.h
19  * @date 11/09/18
20  * @author Alejandro Alvarez Ayllon
21  */
22 
23 #ifndef _SEFRAMEWORK_IMAGE_MIRRORIMAGE_H
24 #define _SEFRAMEWORK_IMAGE_MIRRORIMAGE_H
25 
29 
30 namespace SourceXtractor {
31 
36 template <typename T>
37 class MirrorImage: public Image<T> {
38 protected:
40  }
41 
42 public:
43  template<typename... Args>
44  static std::shared_ptr<MirrorImage<T>> create(Args &&... args) {
45  return std::shared_ptr<MirrorImage<T>>(new MirrorImage{std::forward<Args>(args)...});
46  }
47 
48  std::string getRepr() const override {
49  return "MirrorImage(" + m_img->getRepr() + ")";
50  }
51 
52  int getWidth() const override {
53  return m_img->getWidth();
54  }
55 
56  int getHeight() const override {
57  return m_img->getHeight();
58  }
59 
60  std::shared_ptr<ImageChunk<T>> getChunk(int x, int y, int width, int height) const override {
62  auto chunk = UniversalImageChunk<T>::create(width, height);
63  auto img_w = accessor.getWidth();
64  auto img_h = accessor.getHeight();
65  for (int iy = 0; iy < height; ++iy) {
66  for (int ix = 0; ix < width; ++ix) {
67  chunk->at(ix, iy) = accessor.getValue(img_w - (x + ix) - 1, img_h - (y + iy) - 1);
68  }
69  }
70  return chunk;
71  }
72 
73 private:
75 };
76 
77 } // end SourceXtractor
78 
79 #endif // _SEFRAMEWORK_IMAGE_MIRRORIMAGE_H
Mirrors an image in both X and Y axes.
Definition: MirrorImage.h:37
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
int getWidth() const override
Returns the width of the image in pixels.
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const override
Definition: MirrorImage.h:60
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
int getHeight() const override
Returns the height of the image in pixels.
STL class.
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
Definition: MirrorImage.h:48
int getHeight() const override
Returns the height of the image in pixels.
Definition: MirrorImage.h:56
static std::shared_ptr< UniversalImageChunk< T > > create(Args &&...args)
Definition: ImageChunk.h:142
static std::shared_ptr< MirrorImage< T > > create(Args &&...args)
Definition: MirrorImage.h:44
MirrorImage(std::shared_ptr< const Image< T >> img)
Definition: MirrorImage.h:39
Interface representing an image.
Definition: Image.h:43
std::shared_ptr< const Image< T > > m_img
Definition: MirrorImage.h:74
int getWidth() const override
Returns the width of the image in pixels.
Definition: MirrorImage.h:52